每日一练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 ...
随机推荐
- Autofac使用代码方式进行组件注册【不需要依赖】
public class AutofacFactory2 { IBank bank; public AutofacFactory2() { ...
- linux查看指定时间段的日志
不需要tail命令,直接 grep '2018-04-22 12:3[2-9]' tesl.log: 这就是查询指定文件的2018-04-22 12点32分到39分的日志
- python3字典练习(重要)
#keys()返回字典里的所有的键dic = {'k1':'wcj','k2':33,'k3':[11,22,33,]}r = dic.keys()print(r) #结果为ict_keys(['k3 ...
- PostgreSQL在windows 10上的下载和安装
一.下载 PostgreSQL Windows版本下载地址: https://www.postgresql.org/download/windows/ 下载地址包含2个版本,根据个人喜好下载即可: 1 ...
- vscode垂直选中列选中
VSCode列选择快捷键:Alt+Shift+左键
- vue之表单输入绑定
- unittest框架(惨不忍睹低配版)
根据我上个随笔的unittest框架优化得来,虽然对于smtp模块还是有点迷糊,不过还是勉强搭建运行成功了,还是先上代码: #login_test.py import requests class L ...
- C#串口数据收发数据
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...
- 《Orange‘s》 Bochs环境配置
安装配置bochs之前先写一个简单的引导扇区用来测试: org 07c00h mov ax,cs mov ds,ax mov es,ax call DispStr jmp $ DispStr: mov ...
- 随便说说sequelize的问题
最近在做的项目频繁的修改数据库让人感觉很烦躁,sequelize在执行sync的时候只会重新创建表,如果原先有数据只能直接删除,但是这样显然是不行的,因为数据不能就这么消失了吧. 所以必须要migra ...