/*
* URAL_1068.cpp
*
* Created on: 2013年10月18日
* Author: Administrator
*/
#include <iostream>
#include <cstdio>
using namespace std;
void work(int n){
int s;
if(n > 0){
s = (1+n)*n/2;
}else{
s = (1-n)*n/2 + 1;
}
printf("%d\n",s);
}
int main(){
int n;
scanf("%d",&n);
work(n);
return 0;
}
(datastructure1.5.1)URAL 1068 SUM(计算前n项和)
最新推荐文章于 2019-02-04 12:06:40 发布
本博客介绍了一个名为URAL_1068的C++程序,该程序通过输入整数n来计算特定公式的结果,并使用printf输出结果。
731

被折叠的 条评论
为什么被折叠?



