2 条题解
- 1
信息
- ID
- 153
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 10
- 标签
- (无)
- 递交数
- 1
- 已通过
- 1
- 上传者
C++ :
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main(){
scanf("%d%d",&a,&b);
int sum=(a+b)*(b-a+1)/2;
printf("%d",sum);
return 0;
}
Python :
# coding=utf-8
n=int(input())
m=int(input())
x=0
for i in range(n,m+1):
x=x+i
print(x)