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. php笔记(一)php介绍及数据类型

    php 官方手册:http://php.net/manual/zh/ 1.PHP(全称 Hypertext Preprocessor,超文本预处理器的字母缩写)是一种服务器端脚本语言,它可嵌入到 HT ...

  2. linux学习笔记整理(三)

    第四章 文件的基本管理和XFS文件系统备份恢复本节所讲内容:4.1 Linux系统目录结构和相对/绝对路径.4.2 创建/复制/删除文件,rm -rf / 意外事故4.3 查看文件内容的命令4.4 实 ...

  3. cents上运行wget报错:unable to resolve host address

    wget命令报错.无法解析域名"www.keepalived.rog" [vagrant@RS1 download]$ wget http://www.keepalived.org ...

  4. UVA1153-Keep the Customer Satisfied(贪心)

    Problem UVA1153-Keep the Customer Satisfied Accept: 222  Submit: 1706Time Limit: 3000 mSec Problem D ...

  5. [CQOI2018]解锁屏幕

    嘟嘟嘟 这题感觉真的很简单-- \(O(n ^ 2 logn)\)的做法特别好理解,但得开O2. 看数据范围,肯定是状压dp.但刚开始我没想通状压啥,因为点与点之间还有顺序问题.但后来发现这个顺序是子 ...

  6. idea 修改设置 检测方式为 es6

    intellij idea 14不支持ES6语法!javascript 文件内到处飘红 file>settings>Lauguages & Frameworks>javasc ...

  7. eclipse如何设置断点&断点处运行快捷键

    第一步: 设置断点:在该行最前面边框双击  或快捷键:Ctrl+Shift+B   第二步: Debug 运行启动   第三部: 运行到断点后: 使用快捷键F5,F6,F7单步执行. F5:Step ...

  8. Pycharm远程调试服务器代码(使用Pipenv管理虚拟环境)

    准备工作 1.随便准备一个项目工程,在本地用Pipenv创建一个虚拟环境并生成Pipfile和pipfile.lock文件,如下: 2.准备一台服务器,我这里使用阿里云的ECS SSH连接上 $ ss ...

  9. 进程同步控制(锁,信号量,事件), 进程通讯(队列和管道,生产者消费者模型) 数据共享(进程池和mutiprocess.Pool模块)

    参考博客 https://www.cnblogs.com/xiao987334176/p/9025072.html#autoid-1-1-0 进程同步(multiprocess.Lock.Semaph ...

  10. ModelViewSet 路由 / django logging配置 / django-debug-toolbar使用

    一.ModelViewSet 路由 因为我们正在使用ViewSet代替View,实际上已经不再需要自己来设计URL的配置了.将资源和视图.URL绑定到一起是一个可以自动完成的过程,只需要使用Route ...