HDU 2068(错排+组合数)
来源:互联网 发布:淘宝旺铺有什么功能 编辑:程序博客网 时间:2024/05/19 00:50
本体要用long long
/** * hdu2068 * 错排+组合数 */#include<iostream>#include<cstdio>using namespace std;const int mmax = 30;typedef long long ll;//巧妙求组合数ll C(int m, int n){ ll a = 1; ll b = 1; for(int i = 1; i <= m; i++, n--) { a *= n; b *= i; } return a/b;}int main(){ int w[mmax]; w[0] = 1; w[1] = 0; for(int i = 2; i <= 25; i++) { w[i] = (i-1)*(w[i-1] + w[i-2]); } int n; while(scanf("%d", &n) && n) { ll s = 0; for(int i = 0; i <= n/2; i++) { s+= w[i] * C(i, n); } printf("%lld\n", s); } return 0;}
阅读全文
0 0
- HDU 2068(错排+组合数)
- hdu 2068 错排+组合数
- HDU 2068 RPG的错排 (错排+组合数)
- HDU 2068 RPG 的错排(错排问题,组合数)
- HDU 2068 RPG的错排(组合数的处理)
- hdu 2068 错排+组合
- 排错+组合数
- HDOJ 2068 RPG的错排 【错排 组合数】
- [HDU](2049)考新郎 --组合数+错排
- RPG的错排(组合数+错排)
- hdu 2068 RPG的错排 (错排+组合)
- HDU 2068 RPG的错排(错排与组合)
- HDU 2068 RPG的错排(组合数学--错排)
- HDU-2068 RPG的错排(组合, 错排)
- hdu 2049 不容易系列之(4)——考新郎(错排+组合数)
- [BZOJ4517][Sdoi2016]排列计数(错排+组合数)
- bzoj4517 [Sdoi2016]排列计数 (错排 + 组合数)
- [日常] 错排公式+组合数
- Hadoop中正确地添加和移除节点
- 有1-m个数,围成一圈,从第一个开始数,数到n的数退出,输出最后剩下的那个数
- About Xorg building from the source codes
- 单片机驱动74hc595使用方法
- System,Runtime,Robot,Arrays操作类
- HDU 2068(错排+组合数)
- quit 和close 区别
- 百度地图
- Linux环境下搭建主从DNS服务器
- PX4 navigator-TAKEOFF
- applicationContext.xml 配置文件的存放位置
- 防止JS注入
- AI challenger 场景分类 train test softmax
- 接口与抽象类的应用(包括各自设计模式)