A. 模拟
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define pb push_back
#define ll long long
const int INF=0x3f3f3f3f;
const int N=1e6+10,M=1e6+10;
void solve(){
string s;cin>>s;
if(s[0]=='Y'){
for(int i=1;i<s.size();i++){
if(i%3==1){
if(s[i]!='e'){
cout<<"NO"<<'\n';return ;
}
}
if(i%3==2){
if(s[i]!='s'){
cout<<"NO"<<'\n';return ;
}
}
if(i%3==0){
if(s[i]!='Y'){
cout<<"NO"<<'\n';return ;
}
}
}
}
else if(s[0]=='e'){
for(int i=1;i<s.size();i++){
if(i%3==1){
if(s[i]!='s'){
cout<<"NO"<<'\n';return ;
}
}
if(i%3==2){
if(s[i]!='Y'){
cout<<"NO"<<'\n';return ;
}
}
if(i%3==0){
if(s[i]!='e'){
cout<<"NO"<<'\n';return ;
}
}
}
}
else if(s[0]=='s'){
for(int i=1;i<s.size();i++){
if(i%3==1){
if(s[i]!='Y'){
cout<<"NO"<<'\n';return ;
}
}
if(i%3==2){
if(s[i]!='e'){
cout<<"NO"<<'\n';return ;
}
}
if(i%3==0){
if(s[i]!='s'){
cout<<"NO"<<'\n';return ;
}
}
}
}
for(auto c: s){
if(c!='e'&&c!='s'&&c!='Y'){
cout<<"NO"<<'\n';return ;
}
}
cout<<"YES"<<'\n';
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
int t;cin>>t;
//int t=1;
while(t--){
solve();
}
}
B. 模拟
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define pb push_back
#define ll long long
const int INF=0x3f3f3f3f;
const int N=1e6+10,M=1e6+10;
void solve(){
int m,s;cin>>m>>s;int maxx=0,a[2000],mp[2000]={0};
for(int i=1;i<=m;i++){
int x;cin>>x;mp[x]=1;
maxx=max(maxx,x);
}
for(int i=1;i<=maxx;i++){
if(!mp[i])s-=i;
}
if(s==0){
cout<<"YES"<<'\n';return ;
}
while(s>0){
maxx++;
s-=maxx;
if(s==0){
cout<<"YES"<<'\n';return ;
}
}
cout<<"NO"<<'\n';
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
int t;cin>>t;
//int t=1;
while(t--){
solve();
}
}
C. if
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define pb push_back
#define ll long long
const int INF=0x3f3f3f3f;
const int N=1e6+10,M=1e6+10;
void solve(){
ll l,r,x,a,b;cin>>l>>r>>x>>a>>b;
if(a==b){
cout<<0<<'\n';return ;
}
if(abs(a-b)>=x){
cout<<1<<'\n';return ;
}
if(a-l<x&&r-a<x){
cout<<-1<<'\n';return ;
}
if(a-l>=x&&b-l>=x){
cout<<2<<'\n';return ;
}
if(r-a>=x&&r-b>=x){
cout<<2<<'\n';return ;
}
if(a-l>=x&&r-b>=x){
cout<<3<<'\n';return ;
}
if(r-a>=x&&b-l>=x){
cout<<3<<'\n';return ;
}
cout<<-1<<'\n';
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
int t;cin>>t;
//int t=1;
while(t--){
solve();
}
}
D. n 的末尾0一定会加到最后的结果里 我们因为是乘法 我们只需要找2和5 即可
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define pb push_back
#define ll long long
const int INF=0x3f3f3f3f;
const int N=1e6+10,M=1e6+10;
void solve(){
ll n,m;cin>>n>>m;ll k=n;
ll cnt2=0,cnt5=0,cnt=0;ll sum=n;
while(n%10==0)n/=10;
sum=n;
while(sum%2==0)sum/=2,cnt2++;
sum=n;
while(sum%5==0)sum/=5,cnt5++;
while(m>=2&&cnt5>0)m/=2,cnt5--,k*=2;
while(m>=5&&cnt2>0)m/=5,cnt2--,k*=5;
while(m>=10)m/=10,k*=10;
cout<<k*m*1ll<<'\n';
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
int t;cin>>t;
//int t=1;
while(t--){
solve();
}
}
E. 暴力
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define pb push_back
#define ll long long
const int INF=0x3f3f3f3f;
const int N=1e6+10,M=1e6+10;
void solve(){
ll n,h;cin>>n>>h;ll a[200010],maxx=0;
for(int i=1;i<=n;i++)cin>>a[i];
sort(a+1,a+1+n);
for(int k=1;k<=3;k++){
ll ans=0,now=h,cnt=0;
for(int i=1;i<=n;i++){
if(a[i]<now)now+=a[i]/2,ans++;
else {
if(cnt<3){
cnt++;i--;
if(cnt==k)now*=3;
else now*=2;
}
}
}
maxx=max(maxx,ans);
}
cout<<maxx<<'\n';
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
int t;cin>>t;
//int t=1;
while(t--){
solve();
}
}
F 好像是一个珂朵莉树的区间思想