G - RPG的错排(错排)
Description
Input
Sample Input
Sample Output
#include <stdio.h>
__int64 C(int n, int m)
{
__int64 ans = 1, temp = 1;
for(int i = 1; i <= m; i++)
{
ans *= (n - i + 1);
temp *= i;
}
return ans / temp;
}
int main()
{
__int64 n, a[14];
a[1] = 0;
a[2] = 1;
for(int i = 3; i <= 13; i++)
{
a[i] = (i - 1) * (a[i-2] + a[i-1]);
}
while(scanf("%I64d", &n), n)
{
__int64 ans = 1;
for(int i = 2; i <= n / 2; i++)
ans += C(n, i) * a[i];
printf("%I64d\n", ans);
}
}
G - RPG的错排(错排)的更多相关文章
- hdu2068 RPG的错排 错排+组合
RPG的错排 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Subm ...
- HDU2068 RPG的错排 —— 错排
题目链接:https://vjudge.net/problem/HDU-2068 RPG的错排 Time Limit: 1000/1000 MS (Java/Others) Memory Lim ...
- HDU 2068 RPG的错排(错排公式 + 具体解释)
RPG的错排 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Sub ...
- [HDU 2068] RPG的错排 (错排问题)
RPG的错排 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2068 题目大意: 有N个人对应N个名字,然后你去把每一个名字对应到每个人,只要求答对一半 ...
- HDU 2068 RPG错排 [错排公式]
1.题意:1到N的序列的排列中,元素位置与元素值相对应的情况(值为i的元素在某个排列中正好排在第i个位置)大于等于序列规模一半的情况,有多少个? 2.输入输出:每组数据一个数,N,规定输入以0结尾: ...
- Mac下用g++编译opencv程序报错
问题描述: 在Mac下安装好opencv, 安装: bash brew install opencv 写了一个opencv程序: ``` C++ //作用就是:取视频的每一帧, ...
- 【js基础】js排序方法——快排+堆排+插排+选择排
快排 Array.prototype.fastSort = function(){ var arr = this; function sort(left, right, arr){ if( left ...
- short i=1;short i=i+1对或错,错的理由;short i+=1对或错,错的理由
short i=1; i=i+1 i+=1 这是一个类型高级与低级的问题,前面的C是short型的,后面的1为int型的,short型与int型的相加得到short型是不可取,因为必须将int型转换为 ...
- Python入门---易错已错易混淆----知识点
1.not 1 or 0 and 1 or 3 and 4 or 5 and 6 or 7 and 8 and 9 结果会输出啥? 根据优先级:(not 1) or (0 and 1) or (3 a ...
随机推荐
- BOM 浏览器对象模型学习
window对象属性 innerWidth/innerHeight 浏览器窗口的内部宽度与高度 outerWidth/outerHeight 浏览器的外部宽度与高度 length window.fra ...
- C#进程管理程序实现
运行效果图 部分代码如下: #region 打开应用程序按钮事件处理程序 /// <summary> /// 打开应用程序按钮事件处理程序 /// </summary> /// ...
- liunx使用技巧
1.挂载与卸载U盘 新建一个目录:mkdir /mnt/usb; Fdisk –l |less 查看添加之后的设备名,设备文件系统格式 加载U盘设备: mount –t vfat /mnt/usb ...
- How can I get an object's absolute position on the page in Javascript?
How can I get an object's absolute position on the page in Javascript? How can I get an object's abs ...
- 封装的localstorge的插件,store.js
封装的localstorge的插件,store.js https://github.com/marcuswestin/store.js/
- 物理DG主备库切换时遇到ORA-16139: media recovery required错误
在物理DG主备库切换时遇到ORA-16139: media recovery required错误 SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRI ...
- jQuery validate api(转)
官网地址:http://bassistance.de/jquery-plugins/jquery-plugin-validation jQuery plugin: Validation 使用说明 转载 ...
- flexbox 伸缩布局盒
Flexbox(伸缩布局盒) 是 CSS3 中一个新的布局模式,为了现代网络中更为复杂的网页需求而设计. Flexbox 由 伸缩容器 和 伸缩项目 组成.通过设置元素的 display 属性为 ...
- iOS 饼状图
首先先看一下效果: 一.创建饼状图对象 创建饼状图对象用到类是PieChartView.h, 代码如下: self.pieChartView = [[PieChartView alloc] ini ...
- 用JS画斐波那契螺旋线(黄金螺旋线)
偶然看到斐波那契螺旋线(黄金螺旋线)的定义及画图方法,试着用JS画了一下,很漂亮,很好玩 具体定义及画法大家查一下就有了,很简单. 以下是代码: <!DOCTYPE html> <h ...