[*][size=large]题意翻译[/size]
输入两个整数a,b (0<=a,b<=10),计算a+b的值并输出。
其中还提到输出不能有多余的内容,即不能加多空格符号等内容,不然会报Wrong Answer
不能使用文件,不然会报"Runtime Error"或者"Wrong Answer"
[*][size=large]思路[/size]
这个poj用来解释如何编写代码以及提交的例子题目,我也是用此题建立我解题报告的模板。
思路很简单,就是加起来。
[*][size=large]总结[/size]
--使用Java是需要注意一下内容:
(1)只能使用一个java类,并且类名为Main,并且里面要有一个main方法作为类的开始位置。
(2)Java使用1.5
--使用GCC或者G++提交时要注意内容
(1)main方法一定要是int返回类型。
[*][size=large]代码[/size]
(1)C
[img]http://dl.iteye.com/upload/attachment/579008/c44739a7-cd2c-3561-ab36-2ef7a04c197a.png[/img]
(2)C++
[img]http://dl.iteye.com/upload/attachment/579010/a3afb7d1-4f71-3fc9-af31-4253288a7bf5.png[/img]
(3)Java
[img]http://dl.iteye.com/upload/attachment/579012/2b0fd73a-0834-3bcf-8e65-a59b09dacfc0.png[/img]
输入两个整数a,b (0<=a,b<=10),计算a+b的值并输出。
其中还提到输出不能有多余的内容,即不能加多空格符号等内容,不然会报Wrong Answer
不能使用文件,不然会报"Runtime Error"或者"Wrong Answer"
[*][size=large]思路[/size]
这个poj用来解释如何编写代码以及提交的例子题目,我也是用此题建立我解题报告的模板。
思路很简单,就是加起来。
[*][size=large]总结[/size]
--使用Java是需要注意一下内容:
(1)只能使用一个java类,并且类名为Main,并且里面要有一个main方法作为类的开始位置。
(2)Java使用1.5
--使用GCC或者G++提交时要注意内容
(1)main方法一定要是int返回类型。
[*][size=large]代码[/size]
(1)C
[img]http://dl.iteye.com/upload/attachment/579008/c44739a7-cd2c-3561-ab36-2ef7a04c197a.png[/img]
#include "stdio.h"
int main()
{
int a,b;
scanf("%d%d",&a,&b);
printf("%d",a+b);
return 0;
}
(2)C++
[img]http://dl.iteye.com/upload/attachment/579010/a3afb7d1-4f71-3fc9-af31-4253288a7bf5.png[/img]
#include "iostream"
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b;
return 0;
}
(3)Java
[img]http://dl.iteye.com/upload/attachment/579012/2b0fd73a-0834-3bcf-8e65-a59b09dacfc0.png[/img]
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception{
Scanner scan = new Scanner(System.in);
int a = scan.nextInt();
int b = scan.nextInt();
System.out.println(a+b);
}
}