HDOJ 1092 A+B for Input-Output Practice (IV)
来源:互联网 发布:手游运营数据 编辑:程序博客网 时间:2024/05/13 16:55
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.
Sample Input
4 1 2 3 4
5 1 2 3 4 5
0
Sample Output
10
15
import java.util.*;class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); while(sc.hasNext()){ int t = sc.nextInt(); if(t==0) return ; int sum=0; while(t-->0){ int a=sc.nextInt(); sum +=a; } System.out.println(sum); } }}
0 0
- HDOJ 1092:A+B for Input-Output Practice (IV)
- hdoj 1092 A+B for Input-Output Practice (IV)
- hdoj.1092 A+B for Input-Output Practice (IV) 20140721
- HDOJ 1092 A+B for Input-Output Practice (IV)
- HDOJ 1092 A+B for Input-Output Practice (IV)
- HDOJ 1092 A+B for Input-Output Practice (IV)
- HDOJ 1092 A+B for Input-Output Practice (IV)
- Hdoj 1092 A+B for Input-Output Practice (IV)
- hdoj A+B for Input-Output Practice (IV)
- [hdoj试题]A+B for Input-Output Practice (IV)
- HDOJ 1091 A+B for Input-Output Practice (IV)
- 【HDOJ】A+B for Input-Output Practice (IV)
- A+B for Input-Output Practice (IV)
- A+B for Input-Output Practice (IV)
- A+B for Input-Output Practice (IV)
- A+B for Input-Output Practice (IV)
- A+B for Input-Output Practice (IV)
- A+B for Input-Output Practice (IV)
- HDOJ 1091 A+B for Input-Output Practice (III)
- 协议[I2C]_I2C子系统之platform_driver初始化——I2C_adap_s3c_init()
- C语言实现串的匹配算法
- 2015 Bossie评选:最佳开源大数据工具
- delete 指针之后 ,只是释放了指针指向的内存空间,指针不会自动置为NULL,还有delete 遇到指针为NULL时不会调用析构函数
- HDOJ 1092 A+B for Input-Output Practice (IV)
- 协议[I2C]_I2C子系统之I2C总线时钟频率设置
- Mac OS X 下Qt 安装完整手册
- 专题列表常用到的闭包
- 程序员书单_软考篇
- swift开发笔记13 - 添加图表(饼状图)
- “公鸡下蛋”的科技
- cocoapods安装及使用
- 使用 XStream 把 Java 对象序列化为 XML