http://acm.hdu.edu.cn/showproblem.php?pid=1089

Problem Description
Your task is to Calculate a + b.
Too easy?! Of course! I specially designed the problem for acm beginners. 
You must have found that some problems have the same titles with this one, yes, all these problems were designed for the same aim. 
 
Input
The input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line. 
 
Output
For each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input. 
 
Sample Input
1 5
10 20
 
Sample Output
6 30
 
代码:

#include <iostream>

using namespace std;

int main()
{
int a,b;
int sum=0;
while(cin>>a>>b)
{
sum=a+b;
cout<<sum<<endl;
}
return 0;
}

  

http://acm.hdu.edu.cn/showproblem.php?pid=1090

Problem Description
Your task is to Calculate a + b.
 
Input
Input contains an integer N in the first line, and then N lines follow. Each line consists of a pair of integers a and b, separated by a space, one pair of integers per line. 
 
Output
For each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input. 
 
Sample Input
2 1 5 10 20
 
Sample Output
6
30
 
代码:

#include <iostream>

using namespace std;

int main()
{
int T;
cin >> T;
int sum=0;
for(int i = 1;i <= T;i ++)
{
int a,b;
cin>>a>>b;
sum=a+b;
cout<<sum<<endl;
}
return 0;
}

  

http://acm.hdu.edu.cn/showproblem.php?pid=1091

Problem Description
Your task is to Calculate a + b.
 
Input
Input contains multiple test cases. Each test case contains a pair of integers a and b, one pair of integers per line. A test case containing 0 0 terminates the input and this test case is not to be processed.
 
Output
For each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input. 
 
Sample Input
1 5
10 20
0 0
 
Sample Output
6
30
 
代码:

#include <iostream>

using namespace std;

int main()
{
int a,b;
int sum = 0;
while(cin >> a >> b)
{
if(a == 0 && b == 0)
break;
else
sum = a + b;
cout << sum << endl;
}
return 0;
}

  

http://acm.hdu.edu.cn/showproblem.php?pid=1092

Problem Description
Your task is to Calculate the sum of some integers.
 
Input
Input contains multiple test cases. Each test case contains a integer N, and then N integers follow in the same line. A test case starting with 0 terminates the input and this test case is not to be processed.
 
Output
For each group of input integers you should output their sum in one line, and with one line of output for each line in input. 
 
Sample Input
4 1 2 3 4
5 1 2 3 4 5
0
 
Sample Output
10
15
 
代码:

#include <iostream>

using namespace std;

int main()
{
int n;
while(cin>>n)
{
if(n==0)
break;
int sum=0;
for(int i=1; i<=n; i++)
{
int x;
cin>>x;
sum+=x;
}
cout<<sum<<endl;
}
return 0;
}

  

http://acm.hdu.edu.cn/showproblem.php?pid=1093

Problem Description
Your task is to calculate the sum of some integers.
 
Input
Input contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line. 
 
Output
For each group of input integers you should output their sum in one line, and with one line of output for each line in input. 
 
Sample Input
2
4 1 2 3 4
5 1 2 3 4 5
 
Sample Output
10
15
 
代码:

#include <bits/stdc++.h>

using namespace std;

int main()
{
int N,M;
cin >> N; for(int i=1;i<=N;i++)
{
int sum=0;
cin>>M;
for(int j=1;j<=M;j++)
{
int x;
cin>>x;
sum+=x;
}
cout<<sum<<endl;
}
return 0;
}

  

http://acm.hdu.edu.cn/showproblem.php?pid=1094

Problem Description
Your task is to calculate the sum of some integers.
 
Input
Input contains multiple test cases, and one case one line. Each case starts with an integer N, and then N integers follow in the same line. 
 
Output
For each test case you should output the sum of N integers in one line, and with one line of output for each line in input. 
 
Sample Input
4 1 2 3 4
5 1 2 3 4 5
 
Sample Output
10
15
 
代码:

#include <bits/stdc++.h>

using namespace std;

int main()
{
int N;
while(scanf("%d",&N)!=EOF)
{
int sum=0;
for(int i=1;i<=N;i++)
{
int x;
cin>>x;
sum+=x;
}
cout<<sum<<endl;
}
return 0;
}

  

http://acm.hdu.edu.cn/showproblem.php?pid=1095

Problem Description
Your task is to Calculate a + b.
 
Input
The input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line. 
 
Output
For each pair of input integers a and b you should output the sum of a and b, and followed by a blank line. 
 
Sample Input
1 5
10 20
 
Sample Output
6

30

 
代码:

#include <bits/stdc++.h>

using namespace std;

int main()
{
int a,b;
int sum=0;
while(cin>>a>>b)
{
sum=a+b;
cout<<sum<<endl<<endl;
}
return 0;
}

http://acm.hdu.edu.cn/showproblem.php?pid=1096

Problem Description
Your task is to calculate the sum of some integers.
 
Input
Input contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line. 
 
Output
For each group of input integers you should output their sum in one line, and you must note that there is a blank line between outputs.
 
Sample Input
3
4 1 2 3 4
5 1 2 3 4 5
3 1 2 3
 
Sample Output
10

15

6

 
代码:

#include <bits/stdc++.h>

using namespace std;

int main()
{
int N,M;
cin>>N;
for(int i=1;i<=N;i++)
{
int sum=0;
cin>>M;
for(int j=1;j<=M;j++)
{
int x;
cin>>x;
sum+=x;
}
if(N!=i)
cout<<sum<<endl<<endl;
else
cout<<sum<<endl;
}
return 0;
}

  

HDU 1089 到1096 a+b的输入输出练习的更多相关文章

  1. C++ 的简单输出输入 HDU 1089~1096

    A+B for Input-Output Practice (I) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ...

  2. HDU 1089 A+B for Input-Output Practice (I)

    #include <cstdio> int main() { int a,b; while(scanf("%d%d",&a,&b)!=EOF) prin ...

  3. HDU题解索引

    HDU 1000 A + B Problem  I/O HDU 1001 Sum Problem  数学 HDU 1002 A + B Problem II  高精度加法 HDU 1003 Maxsu ...

  4. 小C的故事(快速学C语言,,,极速版!)

    前几天这篇博客写了太多废话! 删啦~~. 本篇博客只是为chd A协的全嫩小鲜肉入门C语言的预科, 如果你在此处学习C语言, 不幸走火入魔, 小弱概不负责. //请直接随便找个C语言编译器,抄一下下面 ...

  5. 网络爬虫 - 真·AC自动机

    前几天无聊,忽然想写点有趣的代码,关于网络方面的,刚开始就想写一个能从oj上自动拉个比赛的软件,后来查资料时看到了神奇的AC自动机,于是自己也去实现了遍. 一天狂A 500多道...就当自娱自乐了.在 ...

  6. 2道acm编程题(2014):1.编写一个浏览器输入输出(hdu acm1088);2.encoding(hdu1020)

    //1088(参考博客:http://blog.csdn.net/libin56842/article/details/8950688)//1.编写一个浏览器输入输出(hdu acm1088)://思 ...

  7. HDU 2993 MAX Average Problem(斜率DP经典+输入输出外挂)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2993 题目大意:给出n,k,给定一个长度为n的序列,从其中找连续的长度大于等于k的子序列使得子序列中的 ...

  8. hdu(杭电oj)输入输出练习题目总结

    1000.1001 .1089.1090.1091.1092.1093.1094.1095.1096

  9. hdu 1426(DFS+坑爹的输入输出)

    Sudoku Killer Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tot ...

随机推荐

  1. Stopwatch + C#打印日志方法

    打印一个接口.方法的运行时间在程序中是很容易遇到的一件事情:现在,我就分享一个我在工作中使用的临时打印日志的方法和结合 Stopwatch 打印测量某个时间间隔的运行时间的方法. Stopwatch ...

  2. 文件下载中使用inputStream流获取文件大小

    inputStream.available()获取的是文件的字节大小 InputStream inputStream = new FileInputStream(new File(path)); re ...

  3. Markdown编辑器开发记录(一):开发的初衷和初期踩的坑

    先说下选择Markdown编辑器的原因,我们进行平台开发,需要很多的操作手册和API文档,要在网站中展示出来就需要是HTML格式的文件,但是由于内容很多,不可能全部由技术人员进行文档的编写,如果是只有 ...

  4. IntelliJ IDEA LicenseServer激活及使用

    一.激活 IntelliJ IDEA下载地址:https://www.jetbrains.com/idea/download/#section=windows 原文地址:http://blog.csd ...

  5. spring cloud(Greenwich.M2) hystrix dashboard 报/actuator/hystrix.stream 404 Not Found的问题

    consumer端不引用spring-boot-starter-actuator的情况 Consumer端会报Unable to connect to Command Metric Stream.新建 ...

  6. jenkins使用1----初始化设置

    ####一.基本设置 1.首先找到系统管理 2.再找到全局配置一把黄色的锁头 3.新增JDK.Maven等 别名随便 下面的值添加jdk在jenkins这台机器上的位置,如果没找到可以点击自动安装,并 ...

  7. Feature Extractor[ResNet v2]

    0. 背景 何凯明大神等人在提出了ResNet网络结构之后,对其做了进一步的分析工作,详细的分析了ResNet 构建块能起作用的本质所在.并通过一系列的实验来验证恒等映射的重要性,并由此提出了新的构建 ...

  8. Java关键字(五)——this

    this 也是Java中的一个关键字,在<Java编程思想>第四版第五章5.4小节对 this 关键字是这样介绍的: this 关键字只能在方法内部使用,表示对“调用方法的那个对象”的引用 ...

  9. Postman的Tests标签测试

    接口测试最重要的就是返回数据的检查,一个简单的接口,我们可以肉眼检查返回数据,但接口一旦多起来且复杂,每次的检查都会很费劲,此时我们就需要postman 的tests模块来代替 postman面板: ...

  10. Storm-HA 配置

    进入storm/conf目录,修改storm.yaml配置文件为如下内容: # zookeeper ip storm.zookeeper.servers: - "192.168.7.108& ...