欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

杭电(1000 A + B Problem)

程序员文章站 2022-05-13 17:14:32
...

杭电(1000)

A + B Problem

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 914585 Accepted Submission(s): 273769

Problem Description
Calculate A + B.

Input
Each line will contain two integers A and B. Process to end of file.

Output
For each case, output A + B in one line.

Sample Input
1 1

Sample Output
2

Java

import java.util.Scanner;

public class Main
{
    public static void main (String[] args)
  {
    Scanner reader=new Scanner(System.in);
    while(reader.hasNextInt())
    {
        int a=reader.nextInt();
        int b=reader.nextInt();
        System.out.println(a+b);
    }
  } }

C

#include<stdio.h>
int main()
{
int a,b;
while((scanf("%d %d",&a,&b))!=EOF)
{
	printf("%d\n",a+b);
}
return 0;

}

C++

#include<iostream>
using namespace std;
int main()
{
 int a,b;
 while(cin >>a >> b)
{
 cout << a+b << endl;
 
}
return 0;
}
相关标签: 杭电