青少年软件编程(C语言)等级考试试卷(一级)
分数:100 题数:5
一、编程题(共5题,共100分)
1.
字符三角形
试题编号:202012-001
试题类型:编程题
标准答案:
试题难度:一般
试题解析:
#include<bits/stdc++.h>
using namespace std;
int main()
{
char a;
cin>>a;
cout<<" "<<a<<" "<<endl;
cout<<" "<<a<<a<<a<<" "<<endl;
cout<<a<<a<<a<<a<<a<<endl;
}
2.
计算(a+b)*(c-b)的值
试题编号:202012-002
试题类型:编程题
标准答案:
试题难度:一般
试题解析:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
cout<<(a+b)*(c-b);
}
3.
晶晶赴约会
试题编号:202012-003
试题类型:编程题
标准答案:
试题难度:一般
试题解析:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a;
cin>>a;
if(a==1||a==3||a==5) cout<<"NO";
else cout<<"YES";
}
4.
角谷猜想
试题编号:202012-004
试题类型:编程题
标准答案:
试题难度:一般
试题解析:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x;
long n;
cin>>x;
n=x;
while(n!=1&&n)
{
if(n%2==0)
{
cout<<n<<"/2="<<n/2<<endl;
n/=2;
}
else
{
cout<<n<<"*3+1="<<n*3+1<<endl;
n=n*3+1;
}
}
cout<<"End";
return 0;
}
5.
求满足条件的3位数
试题编号:202012-005
试题类型:编程题
标准答案:
试题难度:一般
试题解析:
#include<bits/stdc++.h>
using namespace std;
int a[1005];
int s=1;
int main()
{
int x;
cin>>x;
if(x==1) cout<<100;
if(x==2) cout<<121;
if(x==3) cout<<144;
if(x==4) cout<<225;
if(x==5) cout<<400;
if(x==6) cout<<441;
if(x==7) cout<<484;
if(x==8) cout<<676;
if(x==9) cout<<900;
}
202012软件编程(C语言)真题——(1级)