每日一练ACM 2019.04.14
2019.4.14
第1001题:Sum Problem
Problem Description
Hey, welcome to HDOJ(Hangzhou Dianzi University Online Judge).
In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.
Input
The input will consist of a series of integers n, one integer per line.
Output
For each case, output SUM(n) in one line, followed by a blank line. You may assume the result will be in the range of 32-bit signed integer.
Sample Input
1
100
Sample Output
1
5050
解:
package Acm;
import java.util.Scanner;
public class test1 {
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
int a;
int b;
int sum = 0;
while(input.hasNext())
{
a=input.nextInt();
for(int i=1;i<=a;i++){
sum=sum+i;
}
System.out.println(sum);
//System.out.println();
sum=0;
}
}
}
每日一练ACM 2019.04.14的更多相关文章
- 每日一练ACM 2019.04.13
2019.04.13 第1002题:A+B Proble Ⅱ Problem DescriptionI have a very simple problem for you. Given two in ...
- 每日一练ACM 2019.0416
2019.04.16 Problem Description Your task is to Calculate the sum of some integers. Input Input ...
- 每日一练ACM 2019.0422
Problem Description 根据输入的半径值,计算球的体积. Input 输入数据有多组,每组占一行,每行包括一个实数,表示球的半径. Output 输出对应的球的体积,对于每组输 ...
- 每日一练ACM 2019.0417
Problem Description 给定两个正整数,计算这两个数的最小公倍数. Input 输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数. Output 对于每个测试 ...
- 每日一练ACM 2019.0418
Problem Description 输入两点坐标(X1,Y1),(X2,Y2),计算并输出两点间的距离. Input 输入数据有多组,每组占一行,由4个实数组成,分别表示x1,y1,x2,y2 ...
- 每日一练ACM
2019.04.15 第1000题:A+B Problem Problem DescriptionCalculate A + B. InputEach line will contain two in ...
- HTML5每日一练之figure新标签的应用
igure元素是一种元素的组合,可带有标题(可选).figure标签用来表示网页上一块独立的内容,将其从网页上移除后不会对网页上的其他内容产生影响.figure所表示的内容可以是图片.统计图或代码示例 ...
- PowerBI更新2019/04 - 解决方案架构 - PowerBI Solution Architecture(一图胜万字!)
Power BI 架构图 (2019/04) 1) Power BI Desktop 是一个免费的工具.它可以用来准备和管理数据模型:包括链接各种数据:做数据清洗:定义关系:定义度量值和层级关系:应用 ...
- [python每日一练]--0012:敏感词过滤 type2
题目链接:https://github.com/Show-Me-the-Code/show-me-the-code代码github链接:https://github.com/wjsaya/python ...
随机推荐
- 深入理解Java虚拟机之JVM垃圾回收随笔
1.对象已经死亡? 1.1引用计数法:给对象中添加一个引用计数器,每当有一个地方引用他时,计数器值就加1:当引用失效时,计数器值就减1:任何时刻计数器都为0的对象就是不可能再被使用 的.但是它很难解决 ...
- Alpha冲刺
第一天 日期:2018/6/16 1.今日完成任务情况以及遇到的问题 张天旭:根据系统的需求,完成数据库的设计 周甜甜:完成系统后台登录界面的设计及登录功能的实现 李蕾:完成系统后台首页的设计 张海鑫 ...
- 20175213《Java程序设计》实验二Java面向对象程序设计实验报告
实验内容 1.初步掌握单元测试和TDD 2.理解并掌握面向对象三要素:封装,继承,多态 3.初步掌握UML建模 4.熟悉S.O.L.I.D原则 5.了解设计模式 知识总结 1.伪代码 2.产品代码: ...
- R语言-时间序列图
1.时间序列图 plot()函数 > air<-read.csv("openair.csv") > plot(air$nox~as.Date(air$date,& ...
- 富文本编辑器 CKeditor 配置使用 (带附件)
Ckeditor下载地址:http://ckeditor.com/download 1.CKeditor的基本配置 var textval=CKEDITOR.instances.TextArea1.g ...
- centos7 安装memcached
(1)编译安装Memcached 1.51.1 安装依赖包libevent# yum -y install epel-release# yum -y install libevent libevent ...
- Window上编译最新版libCef(Branch 2704)(转载)
转自http://blog.csdn.net/mfcing/article/details/52066579 1.开发环境搭建 VS2010及以上版本,CMake 2.8.12.1及以上版本.我安 ...
- pyautogui 文档(一):简介
PyAutoGUI 可实现控制鼠标.键盘.消息框.截图.定位等功能,最近做了个自动化需要这些,故了解并记录下 自动化需要操作win7上的一个app,用PyAutoGUI做的,定位坐标,点击鼠标等,但是 ...
- python——jieba分词过程
import jieba """函数2:分词函数""" def fenci(training_data): ""&quo ...
- python_Tkinter
Tkinter相关 python支持多种图形界面的第三方库,包括:TKwxWidgetsQTGTK等等但是python自带的库是支持TK的TKinter,使用使用Tkinter,无需安装任何包,就可以 ...