1137: 零起点学算法44——多组测试数据输出II
1137: 零起点学算法44——多组测试数据输出II
Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lld
Submitted: 1513 Accepted: 1007
[Submit][Status][Web Board]
Description
对于每一组数据输入后先处理然后输出结果,再输入第2组数据,
输出数据之间要求有一个空行
int main()
{
int a,b,c,t=0;
while(scanf("%d%d",&a,&b)!=EOF)
{
c=a+b;
if( t>0) printf("\n");
printf("%d\n",c);//注意后面的\n
t++; }
}
Input
多组测试数据,每组输入3个整数
Output
对于每组测试数据,输出1行,内容为输入的3个数的和,每2组测试数据之间有1个空行
Sample Input 
1 2 3
4 5 6
Sample Output
6 15
Source
#include<stdio.h>
int main(){
int a,b,c,t=;
while(scanf("%d%d%d",&a,&b,&c)!=EOF){
if(t>) printf("\n");
printf("%d\n",a+b+c);
t++;
}
return ;
}
//别小看这题简单。 记住 最后一组数据后面只有一个换行 没有两个, 所以应当是先if判断再输出,而不是先输出后判断。 虽然最后结果一样,但是最后的换行不一样!!!
1137: 零起点学算法44——多组测试数据输出II的更多相关文章
- Problem F: 零起点学算法42——多组测试数据输出II
#include<stdio.h> int main() { ; while(scanf("%d%d%d",&a,&b,&c)!=EOF) { ...
- 1136: 零起点学算法43——多组测试数据输出I
1136: 零起点学算法43--多组测试数据输出I Time Limit: 1 Sec Memory Limit: 128 MB 64bit IO Format: %lldSubmitted: ...
- 1135: 零起点学算法42——多组测试数据(求和)IV
1135: 零起点学算法42--多组测试数据(求和)IV Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted ...
- 1134: 零起点学算法41——多组测试数据(a+b)III
1134: 零起点学算法41--多组测试数据(a+b)III Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitt ...
- 1133: 零起点学算法40——多组测试数据(a+b)II
1133: 零起点学算法40--多组测试数据(a+b)II Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitte ...
- 1132: 零起点学算法39——多组测试数据(a+b)
1132: 零起点学算法39--多组测试数据(a+b) Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: ...
- Problem D: 零起点学算法40——多组测试数据(求和)IV
#include<stdio.h> int main() { int n,i,sum,a; ) { sum=; ;i<=n;i++) { scanf("%d",& ...
- 1145: 零起点学算法52——数组中删数II
1145: 零起点学算法52--数组中删数II Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: 293 ...
- Problem E: 零起点学算法84——数组中删数II
#include<stdio.h> int main() { ],b[],i,flag=; while(scanf("%d",&n)!=EOF) { ;i< ...
随机推荐
- java第二天
while循环 基本格式: int sum=0: int i =0:初始化循环变量值 while(i<10循环条件){ 循环变量变化的过程 i++: 循环体 sum+=i; System.out ...
- smarty模板基础1
smarty模板的作用可以让前端和后端分离(也就是前端的显示页面和后端的php代码). smarty模板的核心是一个类,下载好的模板中有这么几个重要的文件夹 (1)libs核心文件夹(2)int.in ...
- github学习(一)
初识github篇. 一.什么是github: GitHub 是一个面向开源及私有软件项目的托管平台,因为只支持 Git 作为唯一的版本库格式进行托管,故名 GitHub. g ...
- Visual Studio 2017正式版离线安装及介绍
Visual Studio 2017 RTM正式版离线安装及介绍. 首先至官网下载:https://www.visualstudio.com/zh-hans/downloads/ VS 2017 正式 ...
- LeetCode 笔记总结
前言 之前把一些LeetCode题目的思路写在了本子上,现在把这些全都放到博客上,以后翻阅比较方便. 题目 99.Recover Binary Search Tree 题意 Two elements ...
- html表单 2017-03-10PM
在写表单之前补充一点:网页名以及属性的值命名都不能用中文,尽量用英文或拼音. html表单特写 1.表单格式 <form method="get/post" action=& ...
- String to Integer (atoi) leetcode
Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. ...
- Bzoj超级经验大放送题集(好评如潮哦~~~)
其实这些是因为没有数据才形成的...唯一可惜的是这些都是需要300软妹币才能打开的萌萌哒权限题*^_^* 好啦,吾来教你如何快速AC么么哒 pascal: 1 begin end. //Pascal ...
- “Dynamic Web Module 3.0 requires Java 1.6 or newer.”错误 (转别人)
eclipse maven 在项目的pom.xml的<build></build>标签中加入: <plugins> <plugin> <group ...
- 《Machine Learning》系列学习笔记之第三周
第三周 第一部分 Classification and Representation Classification 为了尝试分类,一种方法是使用线性回归,并将大于0.5的所有预测映射为1,所有小于0. ...