1175:ACM水题
2017-09-08 16:16
246 查看
1175:ACM水题
Description
ACM中把一种题称作“水题”,顾名思义就是题目很水,很简单。为了促进提高大伙的编程兴趣,
zjahstu决定贯彻“没有最水,只有更水”的原则。
现在给定两个数a和b, 计算[a,b]之间整数的和。(当a=b=0时候表示输入结束,不必处理)
Input
1 100
1 10
99 100
0 0
Output
5050
55
199
Sample Input
1 100
1 10
99 100
0 0
Sample Output
5050
55
199
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
int a,b,i;
while(2==scanf("%d%d",&a,&b))
{
if(a==0&&b==0)
return 0;
int count=0;
for(i=a;i<=b;i++)
{
count=count+i;
}
cout<<count<<endl;
}
return 0;
}
Description
ACM中把一种题称作“水题”,顾名思义就是题目很水,很简单。为了促进提高大伙的编程兴趣,
zjahstu决定贯彻“没有最水,只有更水”的原则。
现在给定两个数a和b, 计算[a,b]之间整数的和。(当a=b=0时候表示输入结束,不必处理)
Input
1 100
1 10
99 100
0 0
Output
5050
55
199
Sample Input
1 100
1 10
99 100
0 0
Sample Output
5050
55
199
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
int a,b,i;
while(2==scanf("%d%d",&a,&b))
{
if(a==0&&b==0)
return 0;
int count=0;
for(i=a;i<=b;i++)
{
count=count+i;
}
cout<<count<<endl;
}
return 0;
}
相关文章推荐
- 1175: ACM"水题"
- 湖南科技大学校赛 问题 H: ACM实验室招新啦!! 水题
- 杭电acm2524矩形A + B(水题)
- 2016 ACM/ICPC Asia Regional Shenyang Online HDU 5900 QSC and Master(区间dp水题)
- ACM水题堆(一)C - 人见人爱A^B
- ACM水题堆(一)T-switch game
- hdu 5053 the Sum of Cube 水题 2014 ACM/ICPC Asia Regional Shanghai Online
- HDU 5443 The Water Problem(水题 找区间最大值)——2015 ACM/ICPC Asia Regional Changchun Online
- [ACM_水题] 不要62(hdu oj 2089, 不含62和4的数字统计)
- ACM: 水题 分数运算 poj 3979
- ACM: 金华赛区题目 水题…
- 水题啊水题,可我偏偏没做出来!!!(SDUT 2013春季ACM集训_12级周赛3 A题 )
- HDU6213 Chinese Zodiac STL水题 [2017 ACM/ICPC Asia Regional Qingdao Online]
- 2016 acm香港网络赛 F题. Crazy Driver(水题)
- 2013-2017 ACM/ICPC 区域赛&final 水题和铜牌题
- ACM-ICPC 长沙现场赛 C 题 ZOJ3728(为什么我A过的数学题都是水题T_T)
- ACM水题-AB串(AC,分情况,要小心陷阱,两种思路)
- acm水题
- ACM-水题之Digital Roots——hdu1013
- ACMSTEP 1.2.5 IBM Minus One//超级水题