hdoj1903
2015-07-17 10:03
183 查看
A+B for Input-Output Practice (V)
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 56639 Accepted Submission(s): 38152 [align=left]Problem Description[/align]Your task is to calculate the sum of some integers. [align=left]Input[/align]Input contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line. [align=left]Output[/align]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. [align=left]Sample Input[/align]2 4 1 2 3 4 5 1 2 3 4 5
[align=left]Sample Output[/align]
10 15
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner input=new Scanner(System.in); int i=input.nextInt(); while(i>0){ int s=0; int j=input.nextInt(); for(int k=0;k<j;k++) s+=input.nextInt(); System.out.println(s); i--; } } }
相关文章推荐
- 动态计算UITableViewCell高度详解
- 解决VM克隆网卡无法识别
- Laucnher3如何实现给hotseat上的应用显示title
- leetCode(39):Lowest Common Ancestor of a Binary Tree
- Java 重写hashCode 方法和equals方法
- 经典SQL语句大全
- leetCode(39):Lowest Common Ancestor of a Binary Tree 分类: leetCode 2015-07-17 10:03 114人阅读 评论(0) 收藏
- 金错刀:【马化腾的红包:一款7星级产品如何炼成?】
- 最后一周 银行储蓄系统
- HDU 1005 Number Sequence
- js 关于table的操作
- C++11/14 lamba, 仿函数 对比
- error PRJ0019:A Tool returned an error code from"XX.moc"
- JVM概述
- hdoj1902
- UITableviewCell使用以及自定义高度
- 微信相关API
- JVM概述
- Codeforces Round #307 (Div. 2) C. GukiZ hates Boxes (二分)
- boost库解析json的例子