1135: 零起点学算法42——多组测试数据(求和)IV
1135: 零起点学算法42——多组测试数据(求和)IV
Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lld
Submitted: 2439 Accepted: 1277
[Submit][Status][Web Board]
Description
还有一些输入是以上几种情况的组合,具体根据题目对前面几种情况进行组合
比如题目要求是多组测试数据
每组测试数据首先输入一个整数n(如果n=0就表示结束) 然后再输入n个整数
这类题目输入格式如下:
int main()
{
int n,i;
while(scanf("%d",&n)!=EOF && n!=0)
{
for(i=1;i<=n;i++)
{
....//每次输入一个数,共循环n次,需要的时候做其他处理
} }
}
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
Source
#include<stdio.h>
int main(){
int n;
while(scanf("%d",&n)!=EOF&&n!=){
int a,s=;
for(int i=;i<=n;i++){
scanf("%d",&a);
s+=a;
}
printf("%d\n",s);
}
return ;
}
1135: 零起点学算法42——多组测试数据(求和)IV的更多相关文章
- Problem F: 零起点学算法42——多组测试数据输出II
#include<stdio.h> int main() { ; while(scanf("%d%d%d",&a,&b,&c)!=EOF) { ...
- 1137: 零起点学算法44——多组测试数据输出II
1137: 零起点学算法44--多组测试数据输出II Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: ...
- 1136: 零起点学算法43——多组测试数据输出I
1136: 零起点学算法43--多组测试数据输出I Time Limit: 1 Sec Memory Limit: 128 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",& ...
- 1164: 零起点学算法71——C语言合法标识符(存在问题)
1164: 零起点学算法71——C语言合法标识符 Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: 10 ...
- 1145: 零起点学算法52——数组中删数II
1145: 零起点学算法52--数组中删数II Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: 293 ...
随机推荐
- storyboard页面跳转传值
受学姐的影响,习惯纯代码编程,这次要修改别人的代码,很多编程风格还不习惯. 在此之前,页面跳转我都用的是Navigation,故事板上的页面跳转带传值,让我卡了好半天. 页面跳转: [self per ...
- 记使用sed的一次坑
sed做为linux下的三剑客,自然功能强大,但是如果使用不当,反而适得其反,今天就因为这个命令采了很深坑,分析一下原因,以谏后来者. 情景回顾: 项目中使用的一个python爬虫采用的是多线程并发爬 ...
- WPF移动Window窗体(鼠标点击左键移动窗体自定义行为)
XAML代码部分:1.引用System.Windows.Interactivity 2.为指定的控件添加一个拖动的行为 3.很简单的了解行为的作用和用法 <Window xmlns=" ...
- 在Azure上部署带有GPU的深度学习虚拟机
1. 登录https://portal.azure.com 2. 点击"+创建",在弹出的页面搜索"deep learning toolkit for the DSVM& ...
- Debugging
Debugging Debugging A debugger is an application that enables a developer to observe and correct pro ...
- Java IO之File和IO
本系列我们主要总结一下Java中的IO.NIO以及NIO2. java.io.File 学习Java IO,首先让我们来了解File类吧,它是文件和目录路径名的抽象表示形式.因此你千万别误会File类 ...
- image图片拉伸
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px "PingFang SC"; color: #1d9421 } p.p2 ...
- Archlinux 升级 pacman 时遇到的问题及其解决
这是 Archlinux 升级时经常碰到的老问题.提示如下 问题来了 # yaourt -Syua ==> 警告:使用 root 用户构建软件包存在风险. 请使用非特权用户运行 yaourt . ...
- ehcache memcache redis 区别
之前用过redis 和 memcache ,没有ehcache 的开发经验,最近也查阅不少文档和博客,写一些总结,也有不少内容总结与诸多博客中的博主总结: Ehcache EhCache 是一个纯J ...
- fopen参数
此文用于学习交流 原作:http://www.cnblogs.com/ai616818/archive/2012/04/26/2470918.html FILE * fopen(const char ...