杭电(1000 A + B Problem)
程序员文章站
2022-05-13 17:14:32
...
杭电(1000)
A + B Problem
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;
}
上一篇: Hdoj 不要62:题解