1095如题
题目解析:
The input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line.
大致意思是:输入由一系列由空格隔开的整数对(a,b)组成,每行一对整数。
For each pair of input integers a and b you should output the sum of a and b, and followed by a blank line.
大概意思是:对每一对(a,b)进行求和并空行输出
逐步实现代码
#include<stdio.h>
int main()
{
int a,b; //初始化数值,可以留到最后再定义
while(scanf("%d%d",&a,&b)!=EOF){ //首先我们实现输入 n并利用 while 实现 n 次循环求和
printf("%d\n\n",a+b); //换行输出求和的值
}
}
其中while(scanf(“%d%d“,&a,&b)!=EOF)用法详见ACM-while(scanf(“%d%d“,&a,&b)!=EOF)