输入所对应的成绩等级。
Sample Input
-1 81 92 35 68 72 100
Sample Output
Error Good
Excellent Failing Pass Average Excellent
HINT
用switch语句解决这个问题比较方便。
Append Code
append.cc, 答案:
#include
}
switch(x/10) { case 10: case 9: printf(\ case 8: printf(\ case 7: printf(\ case 6: printf(\ case 5: case 4: case 3: case 2: case 1: case 0: printf(\ default: printf(\ } } printf(\}
return 0;
Problem D: A+B Problem
Time Limit: 1 Sec Memory Limit: 2 MB
Submit: 2221 Solved: 1312 [Submit][Status][Web Board]
Description
计算a+b,0<=a,b<1000。
Input
输入有多对整数a和b组成,每对a和b占一行,a,b用空格分开。
Output
每行输出一个a+b的值,顺序与输入对应。
Sample Input
1 2 10 20
Sample Output
3 30
HINT
OJ系统上测试输入结束符为EOF(End Of File),其值为-1。用scanf()把文件所有内容读完后,会读到EOF,所以可以用来判断输入是否完成,测试时可以用Ctrl+Z产生EOF。本题解法参看FAQ。
Append Code
答案:
#include
Problem E: A+B Problem (II) : Input/Output
Pratice
Time Limit: 1 Sec Memory Limit: 2 MB
Submit: 1710 Solved: 1225 [Submit][Status][Web Board]
Description
计算a+b,0<=a,b<1000。
Input
输入的第一行是一个整数N,后面有N对整数a和b,每对a和b占一行,a,b用空格分开。
Output
每行输出一个a+b的和,顺序与输入对应。
Sample Input
2 1 2 10 20
Sample Output
3 30
HINT
N给出了测试样例数,用for循环处理方便。
Append Code
答案:
#include
}
for(i=1;i<=N;i++)
{scanf(\sum=a+b;
printf(\}
return 0;
实验4
Problem A: A+B Problem (III) : Input/Output
Pratice
Time Limit: 1 Sec Memory Limit: 2 MB
Submit: 1609 Solved: 1076 [Submit][Status][Web Board]
Description
计算a+b,0<=a,b<1000。
Input
输入有多对整数a和b组成,每对a和b占一行,a,b用空格分开。当测试样为0 0时表示输入结束,0 0不参与运算。
Output
每行输出一个a+b的值,顺序与输入对应。
Sample Input
1 2 10 20 0 0
Sample Output
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库山科oj题目(4)在线全文阅读。
相关推荐: