首页 > ACM题库 > HDU-杭电 > HDU 1090 A+B for Input-Output Practice (II)[解题报告] c-sharp
2013
11-27

HDU 1090 A+B for Input-Output Practice (II)[解题报告] c-sharp

A+B for Input-Output Practice (II)

问题描述 :

Your task is to Calculate a + b.

输入:

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。此时的数据量还是很小的,耗时却不短。这种方法确实可以,当然或许还有其他的优化方案,但是优化只能针对某些数据,不太可能在所有情况下都能在可接受的时间内求解出答案。