A + B Problem

http://acm.zju.edu.cn/show_problem.php?pid=1001

Time limit: 1 Seconds

Memory limit: 32768K

Calculate a + b

1. Input

The input will consist of a series of pairs of integers a and b,separated by a space, one pair of integers per line.

2. Output

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.

3. Sample Input

1 5

4. Sample Output

6

5. Hint

Use + operator


   1 /*
   2 C++ version
   3 Written by czk
   4 */
   5 #include <iostream>
   6 using namespace std;
   7 
   8 int main()
   9 {
  10     int a, b;
  11     while(cin>>a>>b) {
  12         cout<< a + b << endl;
  13     }    
  14     return 0;
  15 }    

   1 /*
   2 C version
   3 Written by czk
   4 */
   5 #include <stdio.h>
   6 
   7 int main() {
   8     int a, b;
   9     while(scanf("%d%d", &a, &b)!=EOF) {
  10         printf("%d\n", a + b);
  11     }
  12     return 0;
  13 }

zju1001 (2008-02-23 15:36:53由localhost编辑)

ch3n2k.com | Copyright (c) 2004-2020 czk.