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. CentOS 6.5 64位下安装Redis3.0.2的具体流程

    系统环境:CentOS 6.5 64位 安装方式:编译安装 防火墙:开启 Redis版本:Redis 3.0.2 一.环境准备 1.安装 gcc gcc-c++ [root@iZ94ebgv853Z ...

  2. 基于Ubuntu的ESP32平台搭建

    提要:针对于Ubuntu下的ESP32搭建,网上有很多博文,乐鑫官网也有指导手册,对于到家都知道的部分我就一带而过,我主要描述搭建过程中遇到的问题和细节. 1.创建一个ESP的目录 I)在家目录下创建 ...

  3. python学习Day13 函数的嵌套定义、global、nonlocal关键字、闭包及闭包的运用场景、装饰器

    复习 1.函数对象:函数名 => 存放的是函数的内存地址1)函数名 - 找到的是函数的内存地址2)函数名() - 调用函数 => 函数的返回值 eg:fn()() => fn的返回值 ...

  4. Oracle:查询各组最新的一条记录

    oracle中怎么查询各组中最新的一条记录呢?比如说现在有一个表中几条数据如下: 有两种写法:写法一:over partition by 分析函数 SELECT * FROM (select ID_, ...

  5. PhoenixFD插件流体模拟——UI布局【Export】详解

    Liquid Export 流体导出 本文主要讲解Export折叠栏中的内容.原文地址:https://docs.chaosgroup.com/display/PHX3MAX/Liquid+Expor ...

  6. c# 通过URl 获取返回的json格式数据

    方法一 http://blog.csdn.net/angle_greensky110/article/details/52209497 protected string GetJson(string ...

  7. Zabbix 各种报错信息和遇到的问题处理(持续总结更新~~~~~)

    问题1:Zabbix poller processes more than 75% busy 解决: 1.修改配置文件: # vim /etc/zabbix/zabbix_server.conf St ...

  8. 企业BGP网络规划案例(二)

    设计思路梳理 1.AS的划分 : 由于该办公网物理上被划分为总部和两个异地的办公分支,总部和分支互联采用MSTP线路,为了方便管理和更为灵活的进行路由控制,选择BGP作为总部和分支的路由协议.关于AS ...

  9. Hillstone设备管理-设备软件Stone-OS升级

    1.通过sysloader进行StoneOS升级 1)给设备上电按提示按ESC并且进入 Sysloader.参照以下操作提示: 2)在下面选择对应的选项升级os,可以通过tftp.ftp.usb.系统 ...

  10. java_29打印流

    1打印流 PrintStream 和PrintWriter 不负责数据源  只负责数据目的 2.方法 public class Demo {    public static void main(St ...