A+B for Input-Output Practice (IV) (sdut oj)
A+B for Input-Output Practice (IV)
Time Limit: 1000MS Memory Limit: 65536KB
Problem Description
Your task is to Calculate the sum of some integers.
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.
Example Input
4 1 2 3 4 5 1 2 3 4 5 0
Example Output
10 15
Hint
Author
HDOJ
參考程式碼
#include<stdio.h>
int main()
{
int n;
int num;
int sum;
while(scanf("%d",&n) != EOF)
{
sum = 0;
if(n == 0)
break;
else
while(n--)
{
scanf("%d",&num);
sum += num;
}
printf("%d\n",sum);
}
return 0;
}
相關文章
- [#181024][PAT Practice] A+B FormatORM
- 汽車加油問題 SDUT OJ 貪心演算法演算法
- SDUT---OJ《資料結構與演算法》實踐能力專題訓練2 連結串列資料結構演算法
- Practice
- airflow practiceAI
- A+B
- SAP MM GR-based IV, 無GR不能IV?
- shell practice 03
- shell practice 04
- shell practice 05
- shell practice 06
- shell practice 07
- scientifically practice DP
- As Easy As A+B
- Java加密之IVJava加密
- Practice| 流程控制
- OJ搭建
- A+B問題
- IV. Mip-NeRF
- Vegetables need more practice.
- hdu 1720 A+B Coming
- [LeetCode] 2326. Spiral Matrix IVLeetCode
- yolov5s ncnn practiceYOLOCNN
- 杭電oj 2020
- SWUST OJ:195: Buyer
- [Algorithm] 1. A+B ProblemGo
- 1016. 部分A+B (15)
- 653-Two Sum IV - Input is a BST
- SAP HUM 巢狀HU初探 IV巢狀
- Oracle 12.2 RAC on Linux Best Practice DocumentationOracleLinux
- 力扣 653. 兩數之和 IV 二叉樹/binary-tree two-sum IV力扣二叉樹
- 最長公共子序列問題—動態規劃sdut動態規劃
- Vue + Koa 搭建 ACM OJVueACM
- 畢業旅行 oj題
- 信奧OJ的搭建
- 1016 部分A+B (15 分)JavaJava
- HDU 1040 As Easy As A+B(堆排序)排序
- [PAT B] 1011 A+B 和 C
- PAT:1001 A+B Format (20分)ORM