问题 1000. -- A+B Problem

1000: A+B Problem

时间限制: 3 Sec  内存限制: 64 MB
提交: 30  解决: 15
[上一题][提交][讨论版][状态][下一题]

题目描述

此题为练手用题,请大家计算一下a+b的值

输入 [abproblem.in]

输入两个数,a,b

输出 [abproblem.out]

输出a+b的值

样例输入

2 3

样例输出

5

提示

例如:

C语言版:

#include<stdio.h>

int main()

{

int a,b;

scanf("%d%d",&a,&b);

printf("%d\n",a+b);

}



C++版:

#include<iostream>

using namespace std;

int main()

{

int a,b;

cin>>a>>b;

cout<<a+b<<endl;

}



Java版:



import java.io.*;

import java.util.*;

public class Main

{

public static void main(String args[]) throws Exception

{

Scanner cin=new Scanner(System.in);

int a=cin.nextInt(),b=cin.nextInt();

System.out.println(a+b);

}

}



Java jdk 1.4 版

import java.io.*;

import java.util.*;



public class Main

{

public static void main (String args[]) throws Exception

{

BufferedReader stdin =

new BufferedReader(

new InputStreamReader(System.in));



String line = stdin.readLine();

StringTokenizer st = new StringTokenizer(line);

int a = Integer.parseInt(st.nextToken());

int b = Integer.parseInt(st.nextToken());

System.out.println(a+b);

}

}



请注意不要输出过多提示性语句(如:“please input two numbers”),不然会WrongAnswer的

标签

[上一题][提交][讨论版][状态][下一题]