关闭

hdoj A+B for Input-Output Practice (VI)

104人阅读 评论(0) 收藏 举报
分类:

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
代码:
#include<stdio.h>
int main()
{
    int a,sum=0;
        int m;
        while(scanf("%d",&m)!=EOF)
        {
        for(int i=1;i<=m;i++)
        {
        scanf("%d",&a);
           sum=sum+a;
       }
           printf("%d\n",sum);
               sum=0;
           }
   return 0; 
}
注意:没啥注意的 水
0
0
查看评论

hdoj A+B for Input-Output Practice (V)

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 fol...
  • zhaihao1996
  • zhaihao1996
  • 2015-11-20 18:13
  • 274

杭电ACM 1094 A+B for Input-Output Practice (VI)

A+B for Input-Output Practice (VI) Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submissio...
  • neuxxm
  • neuxxm
  • 2012-11-12 01:10
  • 1341

[水题][hdoj_1096]A+B for Input-Output Practice (VIII)

// hdoj_1096 A+B for Input-Output Practice (VIII) #include int main(void) { int n, m, a, sum, i, j; scanf("%d", &n); for(i = 0; ...
  • litiouslove
  • litiouslove
  • 2012-07-31 01:42
  • 3363

HDU1094A+B for Input-Output Practice (VI)(入门题,C,Java两个版本)

A+B for Input-Output Practice (VI) Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total...
  • hurmishine
  • hurmishine
  • 2016-02-23 19:44
  • 544

「HD_ACM」A+B for Input-Output Practice (VII)

Problem Description Your task is to Calculate a + b. ->你的任务是计算A + B   Input The input will consist of a series of ...
  • Simple_Bottle
  • Simple_Bottle
  • 2015-05-02 21:59
  • 1781

杭电ACM 1089 A+B for Input-Output Practice (I)

A+B for Input-Output Practice (I) Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission...
  • neuxxm
  • neuxxm
  • 2012-11-12 00:54
  • 1732

【杭电】[1094]A+B for Input-Output Practice (VI)

输入输出训练
  • u011493189
  • u011493189
  • 2015-12-20 11:05
  • 390

「HD_ACM」A+B for Input-Output Practice (IV)

Problem Description Your task is to Calculate the sum of some integers. ->你的任务是计算一些整数相加   Input Input contains multiple...
  • Simple_Bottle
  • Simple_Bottle
  • 2015-05-02 21:26
  • 934

1096:A+B for Input-Output Practice (VIII)

这个是格式控制问题。
  • BeiZhang1991
  • BeiZhang1991
  • 2014-04-11 17:42
  • 2214

「HD_ACM」 A+B for Input-Output Practice (II)

Problem Description Your task is to Calculate a + b. ->你的任务是计算A + B   Input Input contains an integer N in the fir...
  • Simple_Bottle
  • Simple_Bottle
  • 2015-05-01 22:41
  • 1663
    个人资料
    • 访问:39921次
    • 积分:2790
    • 等级:
    • 排名:第15173名
    • 原创:248篇
    • 转载:13篇
    • 译文:0篇
    • 评论:4条