蓝桥杯大赛模拟题(第二弹)
作者:互联网
//author:pandaoxi
#include <iostream>
using namespace std;
int main(){
int n,m=0;
cin>>n;
for(int i=1;i<=n;i++){
if(i%2) m+=i;
}
cout<<m<<endl;
return 0;
}
//author:pandaoxi
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int n,a[31]={},k=0;
cin>>n;
for(int i=1;i<=n;i++){
a[k++]=pow(i,2);
}
for(int i=0;i<k-1;i++){
cout<<a[i]<<',';
}
cout<<a[k-1]<<endl;
return 0;
}
//author:pandaoxi
#include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
if(n%2) cout<<1<<endl;
else cout<<0<<endl;
return 0;
}
//author:pandaoxi
#include <iostream>
#include <cstring>
using namespace std;
int main(){
char a[10001];
cin>>a;
cout<<strlen(a)<<endl;
return 0;
}
//author:pandaoxi
#include <iostream>
using namespace std;
int main(){
int m,n,k=0,a[10001];
cin>>m>>n;
for(int i=m;i<=n;i++){
if(i%5&&i%7==0) a[k++]=i;
}
for(int i=0;i<(k-1);i++){
cout<<a[i]<<",";
}
cout<<a[k-1]<<endl;
return 0;
}
标签:cout,author,int,namespace,大赛,cin,模拟题,蓝桥,include 来源: https://blog.csdn.net/PanDaoxi2020/article/details/122393921