杭电 1001
来源:互联网 发布:php增删改查源码下载 编辑:程序博客网 时间:2024/05/20 21:47
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.
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
1100
Sample Output
15050
特别注意题目要求即可
#include <iostream>using namespace std;int main(){int n;int sum;while(cin>>n){sum=0;for(int i=1;i<=n;i++){sum+=i;}cout<<sum<<endl;cout<<endl;}return 0;}
0 0
- 杭电acm 1001
- 杭电 1001
- 杭电1001
- 杭电ACM 1001
- 杭电1001
- 杭电 oj 1001
- 杭电OJ 1001
- 杭电1001
- 杭电1001
- 杭电1000,1001
- 杭电ACM 1001
- 杭电1001题
- 杭电oj~~1001
- 杭电ACM 1001
- 杭电ACM 1001
- 杭电ACM----1001
- 杭电 1001
- 杭电1001
- 雷区计算(算法)
- 诛仙锁设计思想路
- 关于socket长连接的心跳包
- javaScript中onclick函数循环事件时闭包的影响
- 438. Find All Anagrams in a String
- 杭电 1001
- .net各个版本多线程的进化
- 图片剪裁之图形圆形和方形选择框
- Source Insight 3.X 插件支持utf8
- 之前写的一个桌面聊天软件的项目总结
- leetcode-Next Greater Element II
- React Native navigator关闭侧滑手势
- 剑指Offer:变态跳台阶
- 对话