C++ 的简单输出输入 HDU 1089~1096
A+B for Input-Output Practice (I)
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) 
Total Submission(s): 129829    Accepted Submission(s): 69922
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;
    while (cin >> a>>b){
        cout <<a+b<<endl;
    }
    return 0;
} A+B for Input-Output Practice (II)
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) 
Total Submission(s): 97559    Accepted Submission(s): 62308
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 n;
    cin >>n;
    while (n--){
        int a,b;
        cin >>a >>b;
        cout <<a+b<<endl;
    }
    return 0;
} A+B for Input-Output Practice (III)
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) 
Total Submission(s): 108194    Accepted Submission(s): 56933
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;
    while (cin>>a>>b,a||b){
        cout<<a+b<<endl;
    }
    return 0;
}A+B for Input-Output Practice (IV)
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) 
Total Submission(s): 99949    Accepted Submission(s): 52783
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,n){
    int sum=0,num;
    while (n--){
        cin>>num;
        sum+=num;
    }
    cout << sum <<endl;
}
    return 0;
}A+B for Input-Output Practice (V)
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) 
Total Submission(s): 74170    Accepted Submission(s): 49454
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 <iostream>
using namespace std;
int main (){
    int n;
    while (cin>>n,n){
    int sum=0,num;
    while (n--){
        cin>>num;
        sum+=num;
    }
    cout << sum <<endl;
}
    return 0;
}A+B for Input-Output Practice (VI)
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) 
Total Submission(s): 69477    Accepted Submission(s): 46476
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 <iostream>
using namespace std;
int main (){
    int n,num;
    while (cin >> n){
        int sum = 0;
        for (int i = 1;i <= n;i ++){
        cin >> num;
        sum += num;
    }
        cout << sum << endl;
    }
    return 0;
}A+B for Input-Output Practice (VII)
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) 
Total Submission(s): 68666    Accepted Submission(s): 45664
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 <iostream>
using namespace std;
int main (){
    int a,b;
    while (cin >> a >> b){
        cout << a+b << endl << endl;
    }
    return 0;
}A+B for Input-Output Practice (VIII)
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) 
Total Submission(s): 149649    Accepted Submission(s): 45273
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 <iostream>
using namespace std;
int main (){
    int n;
    cin >> n;
    while (n--){
        int t,sum = 0,num;
        cin >> t;
        for (int i = 1;i <= t;i++){
            cin >> num;
            sum += num;
        }
        cout << sum << endl;
        if (n)    cout<< endl ;
    }
    return 0;
}C++ 的简单输出输入 HDU 1089~1096的更多相关文章
- 【VB超简单入门】五、基本输出输入
		之前讲了VB IDE的基本操作和概念,接下来要开始将VB语言的编程了. 程序最重要的部分是输出和输入,输入数据,经过计算机处理,再输出结果.本文将介绍两种最基本的输出输入方法,分别是Print.Msg ... 
- 1102: 零起点学算法09——继续练习简单的输入和计算(a-b)
		1102: 零起点学算法09--继续练习简单的输入和计算(a-b) Time Limit: 1 Sec Memory Limit: 520 MB 64bit IO Format: %lldSub ... 
- 1101: 零起点学算法08——简单的输入和计算(a+b)
		1101: 零起点学算法08--简单的输入和计算(a+b) Time Limit: 1 Sec Memory Limit: 128 MB 64bit IO Format: %lldSubmitt ... 
- java入门---简介&简单输出小例子&开发前准备
		Java是由Sun Microsystems公司于1995年5月推出的Java面向对象程序设计语言和Java平台的总称.由James Gosling和同事们共同研发,并在1995年正式推出.J ... 
- Java基础(5)- 输出输入
		输出输入 public class Input { public static void main (String[] args){ try { /** * 打开文件流进行读取 */ Scanner ... 
- c++学习笔记---05--- C++输出输入小结
		C++输出输入小结 题目: 这个程序将向用户提出一个"Y/N"问题,然后把用户输入的值赋值给answer变量. 要求: 针对用户输入'Y'或'y'和'N'或'n'进行过滤: 发掘程 ... 
- C#实现并口输出输入高低电位
		PC并行口各阵脚定义: 1.选通,PC->Printer 2-9 数据(D0-D7) 10.应答(ACK),Printer->PC 11.忙(BUSY),Printer->PC 12 ... 
- HDU 1089 到1096 a+b的输入输出练习
		http://acm.hdu.edu.cn/showproblem.php?pid=1089 Problem Description Your task is to Calculate a + b.T ... 
- python简单的输入与输出
		1 首先利用python完成简单的输出,运行如下: python和c语言类似,但又有所不同,python开发快,语言简洁,我是这样对比学的 输出:print+空格+'要输出的内容',一定要是英文状态下 ... 
随机推荐
- bootstrap 弹框使用
			首先需要准备bootstrap.css,bootstrap .js jquery 我这里有写好的下载地址如下: https://pan.baidu.com/s/1miMahXe 秘钥:tgts & ... 
- 【Java算法】输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数
			import java.util.Scanner; public class CountZimuShuzi { public static void main(String[] args) { Sys ... 
- SQL优化过程中常见Oracle HINT
			在SQL语句优化过程中,我们经常会用到hint,现总结一下在SQL优化过程中常见Oracle HINT的用法: 1. /*+ALL_ROWS*/ 表明对语句块选择基于开销的优化方法,并获得最佳吞吐量, ... 
- 快递小哥逆袭自传:用了6年时间做到了IT部门主管
			在我30岁生日那天,终于收到升职的通知,自己如愿的也从一名小小程序员升职成为IT主管,负责公司硬件设备驱动程序开发项目,工资也从原来月薪10K变到现在月薪20K.或许对于很多人而言,在三十岁的时候,可 ... 
- HTML5 ①
			<!DOCTYPE html> <!--声明当前页面是H5--> html框架: <html> <head lang="en"> & ... 
- Linux3.10.0块IO子系统流程(3)-- SCSI策略例程
			很长时间以来,Linux块设备使用了一种称为“蓄流/泄流”(plugging/unplugging)的技术来改进吞吐率.简单而言,这种工作方式类似浴盆排水系统的塞子.当IO被提交时,它被储存在一个队列 ... 
- Cracking The Coding Interview 5.7
			//An array A[1-n] contains all the integers from 0 to n except for one number which is missing. In t ... 
- linux 创建安装redis服务
			1.找下redis的官方的下载地址:http://download.redis.io/releases/redis-3.2.8.tar.gz 有最新的就下载最新 先下载解压跟安装 wget http ... 
- SQL-8 找出所有员工当前(to_date='9999-01-01')具体的薪水salary情况,对于相同的薪水只显示一次,并按照逆序显示
			题目描述 找出所有员工当前(to_date='9999-01-01')具体的薪水salary情况,对于相同的薪水只显示一次,并按照逆序显示CREATE TABLE `salaries` (`emp_n ... 
- Xilinx FFT IP v9.0 使用(一)
			reference:https://blog.csdn.net/shichaog/article/details/51189711 https://blog.csdn.net/qq_36375505/ ... 
