10分钟一次性AC
#include<iostream>
using namespace std;
int sum(int l, int r)
{
int sum=0;
for(int i=l;i<=r;i++)
sum+=i;
return sum;
}
int main()
{
//freopen("xxx.in","r",stdin);
//freopen("yyy.out","w",stdout);
int l,r;
cin >> l >> r;
cout << sum(l,r);
//fclose(stdin);
//fclose(stdout);
return 0;
}