1!到n!的和
Time Limit: 1
Sec Memory
Limit: 64 MB
Submit:
23 Solved: 14
[Submit][Status][Web
Board]
Description
Input
Output
Sample Input
3 6
Sample Output
9
873
#include
#include
using namespace std;
int main()
{int a,i,n;
double m=1,s=0;
while(cin>>a)
{s=0;
for(i=1;i<=a;i++)
{
m=1;
for(n=1;n<=i;n++)
m=m*n;
s=s+m;}
cout<<std::fixed<<setprecision(0)<<s<<endl;
}
return 0;
}
随机推荐
- xcode project
An Xcode project is a repository for all the files, resources, and information required to build one ...
- 灰度图像阈值化分割常见方法总结及VC实现
转载地址:http://blog.csdn.net/likezhaobin/article/details/6915755 在图像处理领域,二值图像运算量小,并且能够体现图像的关键特征,因此被广泛使用 ...
- H264相关随笔
DR(Instantaneous Decoding Refresh)--即时解码刷新. I和IDR帧都是使用帧内预测的.它们都是同一个东西而已,在编码和解码中为了方便,要首个I帧和其他I帧区别开,所以 ...
- hdu 4472 Count (2012 ACM-ICPC 成都现场赛)
递推,考虑到一n可以由i * j + 1组合出来,即第二层有j个含有i个元素的子树...然后就可以了.. #include<algorithm> #include<iostream& ...
- Beginning Python From Novice to Professional (4) - 演示样本格式字符串
$ gedit price.py #!/usr/bin/env python width = input('Please enter width: ') price_width = 10 item_w ...
- Macosx Setdns
通过C语言接口在Mac App内部对系统的DNS配置进行改动. Mac OS X设置DNS代码 演示样例代码setDNS.c内容例如以下: #include <SystemConfigurati ...
- @font-face(css3属性)实如今网页中嵌入随意字体
@font-face语法规则 @font-face { font-family: <YourWebFontName>; src: <source> [<format> ...
- Welcome Docker to SUSE Linux Enterprise Server【水平有限,中英对比,求纠错】
原文:Welcome Docker to SUSE Linux Enterprise Server Lightweight virtualization is a hot topic these ...
- C#开发Linux守护进程
用C#开发Linux守护进程 Linux守护进程(Daemon)是Linux的后台服务进程,它脱离了与控制终端的关联,直接由Linux init进程管理其生命周期,即使你关闭了控制台,daemon ...
- uva11600 状压期望dp
一般的期望dp是, dp[i] = dp[j] * p[j] + 1; 即走到下一步需要1的时间,然后加上 下一步走到目标的期望*这一步走到下一步的概率 这一题,我们将联通分块缩为一个点,因为联通块都 ...