您的位置:首页 > 其它

数学专项counting:UVa 10079

2013-03-28 22:56 281 查看
很简单找规律,结果为(n*n+n+2)/2。

#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdio>
using namespace std;
typedef long long LL;
LL n;
int main()
{
freopen("in.txt","r",stdin);
while(cin>>n)
{
if(n<0) break;
cout<<(n*n+n)/2+1<<endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: