标签:
#include<iostream>
using namespace std;
int main()
{
int a;
cin>>a;
while(!cin.eof())
{
if(a%2!=0) //注意特殊情况
cout<<(a+1)/2*a<<endl<<endl;
else
cout<<a/2*(a+1)<<endl<<endl;
cin>>a;
}
}
标签:
原文地址:http://www.cnblogs.com/Leonsco/p/5031349.html