1132:0 start-up algorithm 39--multiple sets of test data (a+b) time limit:1 Sec Memory limit:64 MB 64bit IO Format:%lld
submitted:1790 accepted:1222
[Submit] [Status] [Web Board] Description
Calculate a+b. Many of the topics test data will have many groups, generally our online system does not write specific requirements, the input is the end of EOF. The basic framework of the problem is as follows:
int main ()
{
int A, B;
while (scanf ("%d%d", &a,&b)!=eof) //Pay special attention to the wording of this line
{
...//sum
...//output
} return 0;
}
The scanf function has a return value, and if a number is successfully read from the keyboard, the return value is 1, and if 2 is read successfully, 2 is returned. If the end of the file is processed, EOF is returned
Special Note: The requirements of the topic actually refers to the end of each set of data input, immediately output the results of this group, rather than waiting for all the data after the output results
Input
Input as multiple sets of test data. Each row, enter 2 integers a and b per line
Output
For each set of test data, output one line and output the value of a+b until the end of the file
Sample Input
1 12 23 3
Sample Output
246
HINT
Long long can help you
Source
0 Starting point Learning algorithm
1#include <stdio.h>2 intMain () {3 intb;4 while(SCANF ("%d%d", &a,&b)! =EOF) {5printf"%d\n", A +b);6 }7 return 0;8}
1132:0 start-up algorithm 39--multiple sets of test data (A+B)