先推荐两个好用的备赛网站:
1)c语言网
2)new oj
#include<bits/stdc++.h>
using namespace std;
int main()
{
cout<<200/8;
return 0;
}
#include<bits/stdc++.h>
using namespace std;
const int N=20210610;
int f[N];
void init()
{
f[0]=1,f[1]=1;
for(int i=2;i<N;i++)
{
if(f[i]==0)
{
for(int j=2;j*i<N;j++)
{
f[j*i]=1;
}
}
}
}
int check(int x)
{
while(x)
{
if(f[x%10]) return false;
x/=10;
}
return true;
}
int main()
{
init();
int n=20210605;
int res=0;
for(int i=1;i<=n;i++)
{
if(f[i]==0)
{
if(check(i)) res++;
}
}
cout<<res;
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int nian,yue,ri;
int cnt;
int days[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int check(int x)
{
if(x%400==0||(x%4==0&&x%100!=0)) return true;
return false;
}
int solve(int nian,int yue,int ri)
{
int res=0;
while(nian)
{
res+=nian%10;
nian/=10;
}
while(yue)
{
res+=yue%10;
yue/=10;
}
while(ri)
{
res+=ri%10;
ri/=10;
}
if((int)sqrt(res)*(int)sqrt(res)==res) return true;
return false;
}
int main()
{
for(int nian=2001;nian<=2021;nian++)
{
if(check(nian)) days[2]=29;
else days[2]=28;
for(int yue=1;yue<=12;yue++)
{
for(int ri=1;ri<=days[yue];ri++)
{
if(solve(nian,yue,ri)) cnt++;
}
}
}
cout<<cnt;
return 0;
}
#include<bits/stdc++.h>
using namespace std;
long long f[2022];
int main()
{
memset(f,0x3f,sizeof f);
f[0]=0;
for(int i=1;i<=2021;i++)
{
for(int j=0;j<i;j++)
{
f[i]=min(f[i],1+2*f[j]+3*f[i-j-1]+j*j*(i-j-1));
}
}
cout<<f[2021];
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
for(int i=0;i<s.size();i++)
{
if(s[i]>='a'&&s[i]<='z') s[i]-=32;
}
cout<<s;
return 0;
}
#include<bits/stdc++.h>
using namespace std;
const int N=1e8+10;
int cnt;
long long w[N];
long long s[N];
int main()
{
int T;
cin>>T;
int group=1,cnt=1;
for(int i=1;i<=N;i++)
{
if(cnt<group)
{
w[i]=cnt;
cnt++;
}
else if(cnt==group)
{
w[i]=cnt;
cnt=1;
group++;
}
}
for(int i=1;i<=N;i++)
{
s[i]=s[i-1]+w[i];
}
for(int i=0;i<T;i++)
{
int l,r;
cin>>l>>r;
cout<<s[r]-s[l-1]<<endl;
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int n,t;
string s;
int main()
{
cin>>n>>t;
cin>>s;
for(int i=0;i<t;i++)
{
for(int j=1;j<s.size();j++)
{
int q=s[i-1]-'0';
int p=s[i]-'0';
int t=q^p;
s[i]=t+'0';
}
}
cout<<s;
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int n,k;
int check(int x)
{
int cnt=0;
while(x)
{
int t=x&1;
if(t) cnt++;
x>>=1;
}
if(cnt==k) return true;
return false;
}
int main()
{
cin>>n>>k;
int res=0;
for(int i=1;i<=n;i++)
{
if(check(i)) res++;
}
cout<<res;
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int n,m;
string s;
int main()
{
cin>>n>>m>>s;
for(int i=0;i<m;i++)
{
int op,l=0,r=0;
cin>>op;
if(op==1)
{
cin>>l>>r;
for(int j=l-1;j<=r-1;j++)
{
if(s[j]=='(') s[j]=')';
else s[j]='(';
}
}
else
{
cin>>l;
int lef=0,rig=0;
for(int j=l-1;j<s.size();j++)
{
if(s[j]=='(') lef++;
if(s[j]==')') rig++;
if(lef==rig) r=j;
if(lef < rig) break;
}
if(r) cout<<r+1<<endl;
else cout<<0<<endl;
}
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int T,n;
long long ans;
int check(int a,int b,int c)
{
int t=((a^b)^c);
if(t) return false;
if(abs(a-b)<c&&abs(a-c)<b&&abs(b-c)<a) return true;
return false;
}
int main()
{
cin>>T;
while(T--)
{
cin>>n;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
for(int k=1;k<=n;k++)
{
if(check(i,j,k)) ans++;
}
}
}
cout<<ans<<endl;
}
return 0;
}```