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 ...
随机推荐
- mac svn的替代品CornerStone
推荐mac CornerStone客户端图形软件,类似windows下svn tortoise. 一.下载地址 : http://bbs.feng.com/read-htm-tid-7936664.h ...
- 【转】数据库中的join
转自:http://coolshell.cn/articles/3463.html 对于SQL的Join,在学习起来可能是比较乱的.我们知道,SQL的Join语法有很多inner的,有outer的,有 ...
- C#-窗体之间传递参数
主窗体: ].Value.ToString(); AddRoomTypeFrm AddRoomTypeFrm = new AddRoomTypeFrm(getroomtypeid); AddRoomT ...
- Codeforces Round #200 (Div. 1) B. Alternating Current 栈
B. Alternating Current Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/343 ...
- [Practical Git] Configure global settings with git config
You can set up global "git config" settings that apply to all git projects on your system. ...
- mysql使用心得
SET FOREIGN_KEY_CHECKS=0; -- ------------------------------ Table structure for `staff`-- ---------- ...
- 全新的手势,侧滑返回、全局右滑返回都OUT啦!
前言 Android快速开发框架-ZBLibrary 最近将以前的 全局右滑返回 手势功能改成了 底部左右滑动手势. 为什么呢?为了解决滑动返回手势的问题. 目前有3种滑动返回手势 一.侧滑返回 代表 ...
- C++的4种编程范型
基于过程procedural-based 基于对象object-based 面向对象object-oriented 泛型技术generics
- the first assignment of software testing
Github ID: bzdwdmzjsmff Github address: https://github.com/bzdwdmzjsmff alternative article: Increa ...
- JS获取活动区域高和宽
var width; var height; //获取窗口宽度 if (window.innerWidth) ...