国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

1001.Sum Problem

2019-11-06 07:19:14
字體:
來源:轉載
供稿:網友
PRoblem DescriptionHey, welcome to HDOJ(Hangzhou Dianzi University Online Judge).In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.InputThe input will consist of a series of integers n, one integer per line.OutputFor 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 Input1100Sample Output15050

簡單題

#include<iostream>using namespace std;int main(){ long long int a; while (cin >> a) { cout << a*(a + 1) / 2 << endl<<endl; }}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 望都县| 溧阳市| 五指山市| 成安县| 昭通市| 棋牌| 印江| 文登市| 黎平县| 六盘水市| 正定县| 莆田市| 灵川县| 亚东县| 丰宁| 中西区| 曲松县| 凉山| 仁化县| 根河市| 大英县| 铜山县| 台湾省| 鹤峰县| 岑溪市| 孟津县| 腾冲县| 丁青县| 邢台市| 西和县| 加查县| 毕节市| 东阿县| 滕州市| 韶关市| 搜索| 扎囊县| 革吉县| 特克斯县| 湘潭市| 阳江市|