1069 -- A+B(6)
2015-08-29 17:01
363 查看
A+B(6)
Time Limit:1000MS Memory Limit:65536K
Total Submit:346 Accepted:252
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
Sample Output
Source
Time Limit:1000MS Memory Limit:65536K
Total Submit:346 Accepted:252
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
Source
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AK1069 { class Program { static void Main(string[] args) { string sb; while ((sb = Console.ReadLine()) != null) { string[] s = sb.Split(); int n = int.Parse(s[0]); //if (n == 0) break; int sum = 0, i = 1; while (n-- > 0) { sum += int.Parse(s[i]); i++; } Console.WriteLine(sum); } } } }
相关文章推荐
- 远控木马的事情
- 黑马程序员 反射
- 通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)-大壮他哥
- Java—IO流程的介绍
- windows下安装mongoDB扩展
- 选择使用 Sugar.js 还是 Underscore.js ?
- 1068 -- A+B(5)
- 1067 -- A+B(4)
- win8.1(x64)环境,Oracle 客户端连接时报ORA-01019错误总结
- PS 多次剪裁同一图片
- Linux学习笔记------Linux启动流程
- 1066 -- A+B(3)
- Java中抽象类也能实例化
- Linux xargs 命令
- django开发博客(1) 入门
- redis学习篇,全面详解
- 1065 -- A+B(2)
- 1064 -- A+B(1)
- c++ char[] 与 string 转换
- 浅析支持向量机SVM