2013
11-27

# A+B for Input-Output Practice (II)

Input contains an integer N in the first line, and then N lines follow. Each line consists of a pair of integers a and b, separated by a space, one pair of integers per line.

For each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input.

2
1 5
10 20

6
30

#include<stdio.h>
int main()
{
int a,b,n;
scanf("%d",&n);
while(n--)
{
scanf("%d%d",&a,&b);
printf("%d/n",a+b);
}
}

1. 给你一组数据吧：29 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 1000。此时的数据量还是很小的，耗时却不短。这种方法确实可以，当然或许还有其他的优化方案，但是优化只能针对某些数据，不太可能在所有情况下都能在可接受的时间内求解出答案。