uva 11077 置换
/**
给定一个置换,看能不能存在一个置换A^2 = B
思路; 循环节长度为偶数n的置换只能由循环节长度为长度2*n 的置换A*A 而变得。所以只需求出循环节,看循环节长度为偶数的个数是否为偶数个即可。。
训练指南
**/
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int maxn = ; unsigned long long f[maxn][maxn];
int main()
{
memset(f,,sizeof(f));
f[][] = ;
for(int i=;i<=;i++){
for(int j=;j<i;j++){
f[i][j] = f[i-][j];
if(j>) f[i][j] += f[i-][j-]*(i-);
}
}
int n,k;
while(cin>>n>>k){
if(n==&&k==)
break;
cout<<f[n][k]<<endl;
}
return ;
}
uva 11077 置换的更多相关文章
- LA 3641 Leonardo的笔记本 & UVA 11077 排列统计
LA 3641 Leonardo的笔记本 题目 给出26个大写字母的置换B,问是否存在要给置换A,使得 \(A^2 = B\) 分析 将A分解为几个循环,可以观察经过乘积运算得到\(A^2\)后,循环 ...
- UVA 11077 - Find the Permutations(递推)
UVA 11077 - Find the Permutations option=com_onlinejudge&Itemid=8&page=show_problem&cate ...
- UVa 11077 Find the Permutations(置换+递推)
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=35431 [思路] 置换+递推 将一个排列看作一个置换,分解为k个循 ...
- 【UVA 11077】 Find the Permutations (置换+第一类斯特林数)
Find the Permutations Sorting is one of the most used operations in real life, where Computer Scienc ...
- UVA - 11077 Find the Permutations (置换)
Sorting is one of the most usedoperations in real life, where Computer Science comes into act. It is ...
- UVA 11077 Find the Permutations 递推置换
Find the Permutations Sorting is one of the most used operations in real ...
- Uva 11077 Find the Permutations [置换群 DP]
题意: 给定$n$和$k$,问有多少排列交换$k$次能变成升序 $n \le 21$ $uva$貌似挂掉了$vjudge$上一直排队 从某个排列到$1,2,...,n$和从$1,2,...,n$到某个 ...
- UVa 11330 (置换 循环的分解) Andy's Shoes
和UVa11077的分析很类似. 我们固定左脚的鞋子不动,然后将右脚的鞋子看做一个置换分解. 对于一个长度为l的循环节,要交换到正确位置至少要交换l-1次. #include <cstdio&g ...
- UVa 11077 (循环分解 递推) Find the Permutations
把{1, 2, 3,,, n}叫做自然排列 本题便是求有多少个n元排列P要至少经过k次交换才能变为自然排列. 首先将排列P看做置换,然后将其分解循环,对于每个长度为i的循环至少要交换i-1次才能归位. ...
随机推荐
- 宣布发布全新的 Windows Azure 缓存预览版
全新 Windows Azure 缓存的预览版现已发布.此托管服务可以提供闪电般的数据访问速度,以帮助您构建更具可伸缩性.响应更快的应用程序. 详情如下: · 托管式缓存:这一全新的托管服务为需 ...
- 被拒--悲剧之ORA-01017: invalid username/password; logon denied 错误
本地没有安装oracle.安装了oracleclient和PL/SQL Developer.来实现对oracle数据库的可视化操作. 在使用在登录PL/SQL无法登录.提示错误:ORA-01017: ...
- 发送请求工具—Advanced REST Client
Advanced REST Client是Chrome浏览器下的一个插件,通过它能够发送http.https.WebSocket请求.在Chrome商店下搜索Advanced REST Client, ...
- 送给刚刚開始学cocos2d-x引擎 移植Android的同学
刚刚開始学cocos2-x,不过依照教程把已经安了一般Android的开发环境的eclipse又一次升级到安装好cdt和ndk就花了我几十小时,差点都要放弃了. 參考博客 http://blog.cs ...
- 套接字socket 的地址族和类型、工作原理、创建过程
注:本分类下文章大多整理自<深入分析linux内核源代码>一书,另有参考其他一些资料如<linux内核完全剖析>.<linux c 编程一站式学习>等,只是为了更好 ...
- xml 充当简易数据库
后台: 写入节点 public static void Update(string path, string node, string attribute, string value) { try { ...
- Problem A: Artificial Intelligence?
Description Physics teachers in high school often think that problems given as text are more demandi ...
- UVa 1658 Admiral(最小费用最大流)
拆点费用流 --------------------------------------------------------------------- #include<cstdio> # ...
- android中像素单位dp、px、pt、sp的比较
dp(dip): device independent pixels(设备独立像素). 不同设备有不同的显示效果,这个和设备硬件有关,一般我们为了支持WVGA.HVGA和QVGA 推荐使用这个,不依赖 ...
- winform代码:关联窗体数据更新,删除dataGridview中选中的一行或多行
一.关联窗体数据更新 关联窗体数据修改时,如果一个为总体数据显示窗体A,另一个为详细修改窗体B,从A进入B,在B中对数据进行修改,然后返回A,这时A窗体的数据需要更新. 我采用最简单的方法,首先保证每 ...