www.cecil.pro

# 【SWUSTOJ】1001: A+B again!!

## 1001:A+B again!!

Time Limit:1000MS Memory Limit:65536KB
Total Submit:50 Accepted:23 Page View:7918

Input contains multiple test cases, and one case one line. Each case starts with an integer N( 0 < N<=500 ), and then N integers follow in the same line.
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.
4 1 2 3 4
5 1 2 3 4 5
10
15

C语言：
#include"cstdio"  ///也可以使用 < >
int main()
{
int n,x,sum;
while(scanf("%d", &n) != EOF)  /// EOF: end of file  文件结束标志
{
sum = 0;
while(n--)
{
scanf("%d", &x);
sum += x;
}
printf("%d\n", sum);
}
return 0;
}

C++:
#include"iostream"  ///也可以使用 < >
using namespace std;
int main()
{
int n,x,sum;
while(cin >> n)
{
sum = 0;
while(n--)
{
cin >> x;
sum += x;
}
cout << sum << endl;
}
return 0;
}

#### OJ.简单A+B

2016-11-18 21:38:49

#### 【PAT】1001. A+B Format

2014-03-13 20:13:31

#### PAT甲级 1001. A+B Format (20)--两种方法

2017-08-01 08:17:29

#### 中南大学 ACM 1001 A+B(II)

2015-07-16 02:06:22

#### PAT甲级 1001. A+B Format (20) 题目翻译与答案

2017-01-12 20:49:44

#### hdoj A + B Again

2014-12-02 12:40:45

#### Java - PAT - 1001. A+B Format (20)

2016-06-21 22:24:09

#### HDU A + B Again

2013-08-01 19:02:48

#### 牛客网 PAT 乙级 1001 A+B和C (15)

2018-03-05 08:38:22

#### A+B again——累加

2014-01-09 15:50:31