HD1000A + B Problem
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 339636 Accepted Submission(s): 106389
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
杭电入门级水题,应该是大部分人在杭电做的第一道题吧,对于格式的掌握,也是从这里开始的,用三种方法:
c版本:
#include<stdio.h>
int main(){
int a,b;
while(scanf("%d%d",&a,&b )!=EOF)
printf("%d\n",a+b);
}
c++版本:
#include<iostream>
using namespace std;
int main()
{
int a,b;
while(cin>>a>>b)
cout<<a+b<<endl;
return ;
}
java版本:
import java.io.*;
import java.util.*;
class Main { //一定要是Main
public static void main(String[] args) {
Scanner cin = new Scanner(new BufferedInputStream(System.in));
int n,m;
while(cin.hasNext())
{
n = cin.nextInt();
m = cin.nextInt();
System.out.println(n+m);
}
}
}
至与三种方法的大小,自己提交过后一比就知道了。
杭电刷题之路从这里开始….
HD1000A + B Problem的更多相关文章
- 1199 Problem B: 大小关系
求有限集传递闭包的 Floyd Warshall 算法(矩阵实现) 其实就三重循环.zzuoj 1199 题 链接 http://acm.zzu.edu.cn:8000/problem.php?id= ...
- No-args constructor for class X does not exist. Register an InstanceCreator with Gson for this type to fix this problem.
Gson解析JSON字符串时出现了下面的错误: No-args constructor for class X does not exist. Register an InstanceCreator ...
- C - NP-Hard Problem(二分图判定-染色法)
C - NP-Hard Problem Crawling in process... Crawling failed Time Limit:2000MS Memory Limit:262144 ...
- Time Consume Problem
I joined the NodeJS online Course three weeks ago, but now I'm late about 2 weeks. I pay the codesch ...
- Programming Contest Problem Types
Programming Contest Problem Types Hal Burch conducted an analysis over spring break of 1999 and ...
- hdu1032 Train Problem II (卡特兰数)
题意: 给你一个数n,表示有n辆火车,编号从1到n,入站,问你有多少种出站的可能. (题于文末) 知识点: ps:百度百科的卡特兰数讲的不错,注意看其参考的博客. 卡特兰数(Catalan):前 ...
- BZOJ2301: [HAOI2011]Problem b[莫比乌斯反演 容斥原理]【学习笔记】
2301: [HAOI2011]Problem b Time Limit: 50 Sec Memory Limit: 256 MBSubmit: 4032 Solved: 1817[Submit] ...
- [LeetCode] Water and Jug Problem 水罐问题
You are given two jugs with capacities x and y litres. There is an infinite amount of water supply a ...
- [LeetCode] The Skyline Problem 天际线问题
A city's skyline is the outer contour of the silhouette formed by all the buildings in that city whe ...
随机推荐
- 用Visio画UML用例图
1.用例图 用例图描述参与者所理解的系统功能.主要元素是用例和参与者. 用例图的4个基本组件:参与者(Actor).用例(Use Case).关系(Relationship)和系统. 下面以银行储蓄系 ...
- 深入.NET平台和C#编程 错题录
1.在C#中,关于文件操作相关的类说法正确的是(AB) <选择二项> A:FileInfo类提供了用于操作文件的实例方法 B:File类提供了用于操作文件的静态方法 C:Directory ...
- jQuery中filter(),not(),split()的用法
filter(),not(): <script type="text/javascript"> $(document).ready(function() { //输出 ...
- CodeForces Round #298 Div.2
A. Exam 果然,并没有3分钟秒掉水题的能力,=_=|| n <= 4的时候特判.n >= 5的时候将奇数和偶数分开输出即可保证相邻的两数不处在相邻的位置. #include < ...
- MVC+Ef项目(4) 抽象业务逻辑层BLL层
接下来,我们就要到业务逻辑层了,简单的说,业务逻辑层就是调用Repository(可以看做是DAL数据库访问层) 先来看看项目的架构 我们现在就开始来做BLL层. 同样,先编写 UserInfoS ...
- dede 字符串截取
[field:description function="( strlen(strip_tags('@me',''))>100 ? cn_substr(strip_tags('@me' ...
- 【英语】Bingo口语笔记(34) - Hit系列
hit it off 合得来 hit the bottle 喝醉酒 hit the spot 正合要求,恰到好处
- android 语言切换过程分析
android 语言切换过程分析 2014-02-27 18:13 1207人阅读 评论(0) 收藏 举报 语言切换android语言切换android改变语言 最近在看一个bug,系统切换语言后,本 ...
- UIColor,CGColor,CIColor三者的区别和联系
UIColor,CGColor,CIColor三者的区别和联系((转)) 最近看了看CoreGraphics的东西,看到关于CGColor的东西,于是就想着顺便看看UIColor,CIColor,弄清 ...
- hdu 5444 Elven Postman(根据先序遍历和中序遍历求后序遍历)2015 ACM/ICPC Asia Regional Changchun Online
很坑的一道题,读了半天才读懂题,手忙脚乱的写完(套上模板+修改模板),然后RE到死…… 题意: 题面上告诉了我们这是一棵二叉树,然后告诉了我们它的先序遍历,然后,没了……没了! 反复读题,终于在偶然间 ...