ACM比赛中的一个简单问题。。。输入输出把我难住了!
Problem Description
Hey, welcome to HDOJ(Hangzhou Dianzi University Online Judge).
In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.
Input
The input will consist of a series of integers n, one integer per line.
Output
For each case, output SUM(n) in one line, followed by a blank line. You may assume the result will be in the range of 32-bit signed integer.
Sample Input
1
100
Sample Output
1
5050
输入的时候怎么在输入1按回车后不让程序执行,而继续读入第二个数据?
如果回车不能用来标识程序结束的话,怎么让程序知道我输入了所有测试数据开始执行程序?
因为程序是在线提交的,所以必须严格遵守它的输入格式,想不明白了。。。
问题原地址在这里:
http://acm.hdu.edu.cn/showproblem.php?pid=1001
提交能通过的大虾们给讲解讲解,感激不尽!