hdu 1001
来源:互联网 发布:数据错误文件被破坏 编辑:程序博客网 时间:2024/05/07 17:07
Sum Problem
Time Limit: 1000/500 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 412274 Accepted Submission(s): 103727
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 Input1100
Sample Output15050
#include<stdio.h>int main(){int a,sum;while(scanf("%d",&a)!=EOF){sum=0;for(int i=1;i<=a;i++)sum+=i;printf("%d\n\n",sum);}return 0;}
In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.
1100
15050
0 0
- hdu 1001
- HDU 1001
- hdu 1001
- hdu 1001
- HDU 1001
- HDU 1001
- hdu 1001
- HDU 1001
- HDU 1001
- HDU 1001
- hdu 1001
- HDU 1001
- HDU 1001
- hdu 1001
- HDU 1001
- hdu 1001
- HDU 1001
- hdu 1001
- 复数类的设计及加减法的实现(Complex Numbers)
- Word Search
- axis2 webservice
- iOS多线程技术-上
- 华为机试题【11】-报数删除人
- hdu 1001
- 华为机试--最高分是多少
- 获取Android Studio的SHA1
- HTML5基础知识
- [华为OJ] 字符串加解密
- 繁简体(GB<=>Big5)字符串互转的JAVA方式实现
- 多系统环境下,设置开机默认进入的系统
- 数据结构-->(循环)队列 【队列的顺序实现】ADT
- 不要一辈子靠技术混饭吃