HDU 1089 到1096 a+b的输入输出练习
http://acm.hdu.edu.cn/showproblem.php?pid=1089
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.
10 20
- #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;
- }
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
10 20
0 0
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
5 1 2 3 4 5
0
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
4 1 2 3 4
5 1 2 3 4 5
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
5 1 2 3 4 5
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
10 20
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
4 1 2 3 4
5 1 2 3 4 5
3 1 2 3
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的输入输出练习的更多相关文章
- C++ 的简单输出输入 HDU 1089~1096
A+B for Input-Output Practice (I) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ...
- HDU 1089 A+B for Input-Output Practice (I)
#include <cstdio> int main() { int a,b; while(scanf("%d%d",&a,&b)!=EOF) prin ...
- HDU题解索引
HDU 1000 A + B Problem I/O HDU 1001 Sum Problem 数学 HDU 1002 A + B Problem II 高精度加法 HDU 1003 Maxsu ...
- 小C的故事(快速学C语言,,,极速版!)
前几天这篇博客写了太多废话! 删啦~~. 本篇博客只是为chd A协的全嫩小鲜肉入门C语言的预科, 如果你在此处学习C语言, 不幸走火入魔, 小弱概不负责. //请直接随便找个C语言编译器,抄一下下面 ...
- 网络爬虫 - 真·AC自动机
前几天无聊,忽然想写点有趣的代码,关于网络方面的,刚开始就想写一个能从oj上自动拉个比赛的软件,后来查资料时看到了神奇的AC自动机,于是自己也去实现了遍. 一天狂A 500多道...就当自娱自乐了.在 ...
- 2道acm编程题(2014):1.编写一个浏览器输入输出(hdu acm1088);2.encoding(hdu1020)
//1088(参考博客:http://blog.csdn.net/libin56842/article/details/8950688)//1.编写一个浏览器输入输出(hdu acm1088)://思 ...
- HDU 2993 MAX Average Problem(斜率DP经典+输入输出外挂)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2993 题目大意:给出n,k,给定一个长度为n的序列,从其中找连续的长度大于等于k的子序列使得子序列中的 ...
- hdu(杭电oj)输入输出练习题目总结
1000.1001 .1089.1090.1091.1092.1093.1094.1095.1096
- hdu 1426(DFS+坑爹的输入输出)
Sudoku Killer Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
随机推荐
- DBUtils温习1
1.简介 Commons DBUtIls是Apache组织提供的一个开源JDBC工具类库,它是对JDBC的简单封装,学习成本极低,但是使用DBUtils却极大的简化了dao层的开发,少些了很多的jdb ...
- python 类与类之间的关系
一.依赖关系(紧密程度最低) (1)简单的定义:就是方法中传递一个对象.此时类与类之间存在依赖关系,此关系比较低. (2)实例植物大战僵尸简易版 题目要求:创建一个植物,创建一个僵尸 1.植物:名字. ...
- 【Linux基础】history查看历史命令
1.history命令 “history”命令就是历史记录.它显示了在终端中所执行过的所有命令的历史. history //显示终端执行过的命令 history //显示最近10条终端执行过的命令 C ...
- python六十六课——单元测试(二)
''' 封装Person类 ''' class Person: def __init__(self,name,age): self.name=name self.age=age def getAge( ...
- I/O 机制的介绍(Linux 中直接 I/O 机制的介绍)
IO连接的建立方式 1.缓存IO.流式IO: 2.映射IO.块式IO: 3.直接IO. IO的方式: 同步.异步.定时刷新: MMAP与内核空间 mmap使用共享用户空间与内核空间实现: 直接 I/O ...
- 转://使用insert插入大量数据的总结
使用insert插入大量数据的个人经验总结在很多时候,我们会需要对一个表进行插入大量的数据,并且希望在尽可能短的时间内完成该工作,这里,和大家分享下我平时在做大量数据insert的一些经验. 前提:在 ...
- maven tomcat jstl 异常
在跑一个带jstl的例子的时候,遇到了这样一个错误: org.springframework.web.util.NestedServletException: Handler processing f ...
- WiFi-ESP8266入门http(1)-建立服务器,直接发送网
#include <ESP8266WiFi.h> /*** 该工程可以在2.4.0版本esp8266库中运行,没在更高版本库中进行测试 ***/ const char *ssid = &q ...
- 转载 (三)surging 微服务框架使用系列之我的第一个服务(审计日志)
(三)surging 微服务框架使用系列之我的第一个服务(审计日志) 前言:前面准备了那么久的准备工作,现在终于可以开始构建我们自己的服务了.这篇博客就让我们一起构建自己的第一个服务---审计日志 ...
- Linux内核入门到放弃-进程管理和调度-《深入Linux内核架构》笔记
进程优先级 硬实时进程 软实时进程 普通进程 O(1)调度.完全公平调度器 抢占式多任务处理(preemptive multitasking):各个进程都分配到一定的时间段可以执行.时间段到期后,内核 ...