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