2019.04.16
 
 
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.Scanner;

public class Acm20190416 {
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
while(input.hasNext())
{
int n=input.nextInt();
if(n==0) break;
else
{
int[] a=new int[n];
for(int i=0;i<n;i++)
{
a[i]=input.nextInt();
}
int sum=0;
for(int j=0;j<a.length;j++)
{
sum+=a[j];
}
System.out.println(sum);
} }
} }

每日一练ACM 2019.0416的更多相关文章

  1. 每日一练ACM 2019.04.13

    2019.04.13 第1002题:A+B Proble Ⅱ Problem DescriptionI have a very simple problem for you. Given two in ...

  2. 每日一练ACM 2019.04.14

    2019.4.14 第1001题:Sum Problem Problem DescriptionHey, welcome to HDOJ(Hangzhou Dianzi University Onli ...

  3. 每日一练ACM 2019.0422

    Problem Description 根据输入的半径值,计算球的体积.   Input 输入数据有多组,每组占一行,每行包括一个实数,表示球的半径.   Output 输出对应的球的体积,对于每组输 ...

  4. 每日一练ACM 2019.0418

    Problem Description 输入两点坐标(X1,Y1),(X2,Y2),计算并输出两点间的距离.   Input 输入数据有多组,每组占一行,由4个实数组成,分别表示x1,y1,x2,y2 ...

  5. 每日一练ACM 2019.0417

    Problem Description 给定两个正整数,计算这两个数的最小公倍数.   Input 输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数.   Output 对于每个测试 ...

  6. 每日一练ACM

    2019.04.15 第1000题:A+B Problem Problem DescriptionCalculate A + B. InputEach line will contain two in ...

  7. CSS3每日一练之内容处理-嵌套编号

    出处:http://www.w3cfuns.com/thread-5592229-1-17.html 1.大标题一   1.子标题   2.子标题   3.子标题2.大标题二   1.子标题   2. ...

  8. CSS3每日一练之选择器-结构性伪类选择器

    <!DOCTYPE HTML> <html> <head> <meta charset="gb2312"> <title> ...

  9. HTML5每日一练之progress标签的应用

    progress标签:从名字上来看,估计大家也能猜到这个标签是什么标签了,没错,他是一个进度条.在HTML5中我们终于可以不用模拟了. <progress id="W3Cfuns_pr ...

随机推荐

  1. 几种解决方法:idea 找不到符号或找不到包

    一. idea找不到符号,可能是因为编码问题,所以,在File->settings->Editor->File Encodings-找到编码设置,更改为项目的编码要求,一般都为utf ...

  2. Going to university is supposed to be a mind-broadening experience.

    Going to university is supposed to be a mind-broadening experience. That assertion is presumably mad ...

  3. ReactiveX 学习笔记(26)使用 RxJS + React.js 调用 REST API

    JSON : Placeholder JSON : Placeholder (https://jsonplaceholder.typicode.com/) 是一个用于测试的 REST API 网站. ...

  4. 使用mysqldump以分隔文本格式转储数据

    1.使用mysqldump以分隔文本格式转储数据 mysqldump --tab=/tmp/data --fields-terminated-by=, --fields-enclosed-by=&qu ...

  5. IDE 设备(磁盘/CD-ROM)配置不正确。“ide1:1”上具有一个 IDE 从设备,但没有主设备。此配置在虚拟机中无法正常运行。请使用配置编辑器将磁盘/CD-ROM 从“ide1:1”移到“ide1:0”。

    开启vmware报这个错: IDE 设备(磁盘/CD-ROM)配置不正确.“ide1:1”上具有一个 IDE 从设备,但没有主设备.此配置在虚拟机中无法正常运行.请使用配置编辑器将磁盘/CD-ROM ...

  6. 【C++】C++中int与string的相互转换

    一.int转string 1.c++11标准增加了全局函数std::to_string: string to_string (int val); string to_string (long val) ...

  7. cpu资源长期使用率过高导致系统内核锁问题

    服务器跑大量高负载程序,会造成cpu soft lockup. 解决办法: #追加到配置文件中 echo 30 > /proc/sys/kernel/watchdog_thresh #查看 [r ...

  8. S19 文件详解

    http://blog.csdn.net/finewind/article/details/5483554

  9. 获取BDC 消息文本的2种方式

    第一种 LOOP AT MESSTAB. MOVE MESSTAB-MSGNR TO MSGNO. CALL FUNCTION 'WRITE_MESSAGE' EXPORTING MSGID = ME ...

  10. 为sqlserver数据库添加专用用户名

    在安全里面右键添加登录名,输入登录名与密码(可以取消强制密码策略)然后选择用户映射的数据库,勾选db_owner即可.