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. 剑指offer——包含min函数的栈

    题目:定义栈的数据结构,请在该类型中实现一个能够得到栈中所含最小元素的min函数(时间复杂度为O(1)) 该题是自己第一次采用编程的方式来实现Java中栈的功能,故直接借鉴了大牛的代码 import ...

  2. Windows终端工具_MobaXterm

    前言 有人喜欢小而美的工具,有人喜欢大集成工具.这里推荐一款增强型的Windows终端工具MobaXterm,它提供所有重要的远程网络工具(SSH,X11,RDP,VNC,FTP,MOSH ..... ...

  3. 《Dare To Dream》第六次作业:团队项目系统设计改进与详细设计

    团队项目系统设计改进与详细设计 一.团队项目系统设计改进 任务1: a.分析项目系统设计说明书初稿的不足,特别是软件系统结构模型建模不完善内容.  初稿的不足:缺乏每个模块的具体业务流程详细设计和流程 ...

  4. redis cluster介绍

    讲解分布式数据存储的核心算法,数据分布的算法 hash算法 -> 一致性hash算法(memcached) -> redis cluster,hash slot算法 一.概述 1.我们的m ...

  5. Selenium+TestNG+Maven+Jenkins+SVN(转载)

    转载自:https://blog.csdn.net/u014202301/article/details/72354069 一. 创建Maven项目,下载Selenium和TestNG的依赖(依赖可以 ...

  6. 重写COMBOXEDIT

    一.需求 C#种的下拉框ComboBox不支持下拉复选框列表与下拉树形列表等,系统中需要用到的地方使用了第三方组件,现在需要将第三方组件替换掉. 二.设计 基本思路:重写ComboBox,将原生的下拉 ...

  7. spring boot + apache camel 传输文件

    一 sftp搭建略 这里简单说一下为什么使用sftp.ftp和sftp各有优点,差别并不是太大.sftp安全性好,性能比ftp低.ftp对于java来说并不复杂,效率也高.之所以使用sftp主要是可以 ...

  8. ASCII,Unicode,GBK和UTF-8字符编码的区别和联系

    如果经常写python2,肯定会遇到各种“奇怪”的字符编码问题,每次都通过谷歌解决了,但是为什么会造成这种乱码.decode/encode失败等等,本文就字符和字符编码做一个总结,更加清晰区分诸多的编 ...

  9. CMake support in Visual Studio

    Visual Studio 2017 introduces built-in support for handling CMake projects. This makes it a lot simp ...

  10. df命令,du命令,磁盘分区

    df 命令 功能:用来检查linux的文件系统的磁盘空间占用情况 1. df -h 2. 以innode节点数量显示磁盘空间占用情况 df -ih 3. 列出文件系统类型 df -Th du 命令 功 ...