HDU 1094
来源:互联网 发布:淘宝直播开通后怎么办 编辑:程序博客网 时间:2024/05/16 12:41
HDU 1094
A+B for Input-Output Practice (VI)
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 73661 Accepted Submission(s): 49364
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
Author
lcy
#include<stdio.h>
int main(void)
{
int n,a,i,sum;
while(scanf("%d",&n)!=EOF)
{
sum=0;
for(i=0;i<n;i++)
{
scanf("%d",&a);
sum+=a;
}
printf("%d\n",sum);
}
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): 73661 Accepted Submission(s): 49364
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
Author
lcy
#include<stdio.h>
int main(void)
{
int n,a,i,sum;
while(scanf("%d",&n)!=EOF)
{
sum=0;
for(i=0;i<n;i++)
{
scanf("%d",&a);
sum+=a;
}
printf("%d\n",sum);
}
return 0;
}
阅读全文
1 0
- hdu 1094
- hdu 1094
- HDU 1094
- HDU-1094
- HDU 1094
- HDU 1094(水题)
- HDU 1094 JAVA
- hdu
- hdu
- HDU
- hdu ()
- hdu
- hdu
- HDU
- HDU
- hdu
- hdu
- HDU
- 唯一分解定理
- spring aop实现--注解实现和配置实现
- excel入门,如何玩转excel,你早该这么玩Excel笔记6
- linux C++ make 实战--建立一个最简单的工程
- C#练习——统计整型数组中不重复数字的个数、将普通日期格式转换成汉字日期格式、在控制台录入每个学生的姓名,当用户输入quit(不区分大小写)时,程序停止接受用户的输入,并且显示出用户输入的学生的个数
- HDU 1094
- JNotify文件夹监管
- if语句后面的分号
- 2724: [Violet 6]蒲公英
- 动态规划、记忆化搜索:HDU1505-City Game(记忆化搜索)
- MyBatis入门基础(一)
- springboot (1) 快速搭建简单项目
- arcengine栅格渲染(栅格重分类) IRasterClassifyColorRampRenderer
- php 去掉最大值,最小值,求出平均值(简洁代码)