博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hdu 1001
阅读量:6968 次
发布时间:2019-06-27

本文共 835 字,大约阅读时间需要 2 分钟。

Time Limit: 1000/500 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 342001    Accepted Submission(s): 86236

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
 题意:求1到n的和
#include
using namespace std;int main(){ int a,b,c; while(cin>>a){ c=0; for(b=1;b<=a;b++) c+=b; cout<
<
<

 

转载于:https://www.cnblogs.com/wabi87547568/p/4687730.html

你可能感兴趣的文章
Thrift反序列化导致OOM(转)
查看>>
【转载】谷歌酝酿将苹果Swift作为安卓APP主要开发语言
查看>>
自定义用户登录,会话保持,登录后自动跳转原页面
查看>>
Quartz的cronTrigger表达式
查看>>
李洪强经典iOS面试题11
查看>>
Ubuntu 14 常用“快捷键”,Ctrl + Alt + F1 进入终端,按 Ctrl + Alt + F7 回到界面
查看>>
知乎上关于游戏引擎的讨论
查看>>
挂单盯盘核心——从买盘和卖盘看庄家意图
查看>>
Atitit 知识图谱的数据来源
查看>>
解决:error: Cannot fetch repo (TypeError: expected string or buffer)
查看>>
netty Failed to submit an exceptionCaught() event异常
查看>>
oracle 11g RAC 的一些基本概念(三)
查看>>
api数据接口
查看>>
软件测试--测试Demo
查看>>
买房的贷款时间是否是越长越好?https://www.zhihu.com/question/20842791
查看>>
maven整合S2SH
查看>>
mysql锁监视器
查看>>
ramnit病毒
查看>>
Android 增量更新完全解析 是增量不是热修复
查看>>
Java多线程 wait, notify 和 notifyAll
查看>>