Poj/OpenJudge 1000 A+b Problem C/C++/Java
1.题意翻译:
输入两个整数a,b (0<=a,b<=10),计算a+b的值并输出。
其中还提到输出不能有多余的内容,即不能加多空格符号等内容,不然会报Wrong Answer
不能使用文件,不然会报"Runtime Error"或者"Wrong Answer"
2.思路:
这个poj用来解释如何编写代码以及提交的例子题目,我也是用此题建立我解题报告的模板。
思路很简单,就是加起来。
3.总结:
使用Java是需要注意一下内容:
(1)只能使用一个java类,并且类名为Main,并且里面要有一个main方法作为类的开始位置。
(2)Java使用1.5
使用GCC或者G++提交时要注意内容
(1)main方法一定要是int返回类型。
4..代码
(1)C
#include "stdio.h"
int main()
{
int a,b;
scanf("%d%d",&a,&b);
printf("%d",a+b);
return ;
}
(2)C++
#include "iostream"
using namespace std;
int main() {
int a,b;
cin>>a>>b;
cout<<a+b;
return ;
}
(3)Java
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);
}
}
Poj/OpenJudge 1000 A+b Problem C/C++/Java的更多相关文章
- 1000: A+B Problem(NetWork Flow)
1000: A+B Problem Time Limit: 1 Sec Memory Limit: 5 MBSubmit: 11814 Solved: 7318[Submit][Status][D ...
- 尺取法 POJ 3320 Jessica's Reading Problem
题目传送门 /* 尺取法:先求出不同知识点的总个数tot,然后以获得知识点的个数作为界限, 更新最小值 */ #include <cstdio> #include <cmath> ...
- POJ 3100 Root of the Problem || 1004 Financial Management 洪水!!!
水两发去建模,晚饭吃跟没吃似的,吃完没感觉啊. ---------------------------分割线"水过....."--------------------------- ...
- OpenJudge/Poj 1207 The 3n + 1 problem
1.链接地址: http://bailian.openjudge.cn/practice/1207/ http://poj.org/problem?id=1207 2.题目: 总时间限制: 1000m ...
- [POJ 1000] A+B Problem 经典水题 C++解题报告 JAVA解题报告
A+B Problem Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 311263 Accepted: 1713 ...
- Poj OpenJudge 百练 1062 昂贵的聘礼
1.Link: http://poj.org/problem?id=1062 http://bailian.openjudge.cn/practice/1062/ 2.Content: 昂贵的聘礼 T ...
- Poj OpenJudge 百练 2602 Superlong sums
1.Link: http://poj.org/problem?id=2602 http://bailian.openjudge.cn/practice/2602/ 2.Content: Superlo ...
- Poj OpenJudge 百练 1860 Currency Exchang
1.Link: http://poj.org/problem?id=1860 http://bailian.openjudge.cn/practice/1860 2.Content: Currency ...
- Poj OpenJudge 百练 2389 Bull Math
1.Link: http://poj.org/problem?id=2389 http://bailian.openjudge.cn/practice/2389/ 2.Content: Bull Ma ...
随机推荐
- NSArrary和NSString间的转换
将string字符串转换为array数组 NSArray *array = [Str componentsSeparatedByString:@","]; // 注意:NSArr ...
- UIView的Touch事件UIControlEvents详解
首先,UIControlEvents有这个几种: UIControlEventTouchDown = << , // on all touch downs UIControlEventTo ...
- 理解C++ 宏
1.什么是宏,它解决什么问题? 宏的本质是文本替换,考虑下面的需求,程序中多次使用圆周率Pi,在每个地方都使用3.1415,显然很愚蠢.有没有好的办法呢?使用宏,如下: #define Pi 3.14 ...
- mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication的解决方法
直接命令行操作没有问题,但是PHP连接就会报上面的错误. SET old_passwords =0; USE mysql; UPDATE user SET password =PASSWORD('yo ...
- hdu 5432 Pyramid Split 二分
Pyramid Split Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://bestcoder.hdu.edu.cn/contests/conte ...
- BZOJ 1927: [Sdoi2010]星际竞速 费用流
1927: [Sdoi2010]星际竞速 Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://www.lydsy.com/JudgeOnline/pr ...
- Ubuntu Linux下如何配置Android开发环境
下载和安装Win7系统Android开发环境中讲了怎样在Win7系统中安装Android开发环境,那么怎样在Linux系统中配置Android开发环境呢?本篇文章就将演示如何使用Eclipse.And ...
- js hash字符串转成json
var a='account.type=1&account.id=&account.dependFlag=0&account.card.companyId=1&acco ...
- 插件就是生产力——那些不能错过的XCode插件们
古人云"工欲善其事必先利其器",打造一个强大的开发环境,是立即提升自身战斗力的绝佳途径! 晾一下我的武器库,欢迎大家选用:) 全能搜索家CodePilot 2.0 -------- ...
- nginx---reference
nginx (pronounced "engine x") is a free open source web server written by Igor Sysoev, a R ...