/**
给定一个置换,看能不能存在一个置换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 置换的更多相关文章

  1. LA 3641 Leonardo的笔记本 & UVA 11077 排列统计

    LA 3641 Leonardo的笔记本 题目 给出26个大写字母的置换B,问是否存在要给置换A,使得 \(A^2 = B\) 分析 将A分解为几个循环,可以观察经过乘积运算得到\(A^2\)后,循环 ...

  2. UVA 11077 - Find the Permutations(递推)

    UVA 11077 - Find the Permutations option=com_onlinejudge&Itemid=8&page=show_problem&cate ...

  3. UVa 11077 Find the Permutations(置换+递推)

    题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=35431 [思路] 置换+递推 将一个排列看作一个置换,分解为k个循 ...

  4. 【UVA 11077】 Find the Permutations (置换+第一类斯特林数)

    Find the Permutations Sorting is one of the most used operations in real life, where Computer Scienc ...

  5. UVA - 11077 Find the Permutations (置换)

    Sorting is one of the most usedoperations in real life, where Computer Science comes into act. It is ...

  6. UVA 11077 Find the Permutations 递推置换

                               Find the Permutations Sorting is one of the most used operations in real ...

  7. Uva 11077 Find the Permutations [置换群 DP]

    题意: 给定$n$和$k$,问有多少排列交换$k$次能变成升序 $n \le 21$ $uva$貌似挂掉了$vjudge$上一直排队 从某个排列到$1,2,...,n$和从$1,2,...,n$到某个 ...

  8. UVa 11330 (置换 循环的分解) Andy's Shoes

    和UVa11077的分析很类似. 我们固定左脚的鞋子不动,然后将右脚的鞋子看做一个置换分解. 对于一个长度为l的循环节,要交换到正确位置至少要交换l-1次. #include <cstdio&g ...

  9. UVa 11077 (循环分解 递推) Find the Permutations

    把{1, 2, 3,,, n}叫做自然排列 本题便是求有多少个n元排列P要至少经过k次交换才能变为自然排列. 首先将排列P看做置换,然后将其分解循环,对于每个长度为i的循环至少要交换i-1次才能归位. ...

随机推荐

  1. 用Java实现 ,冒泡排序与普通排序的区别

     冒泡排序与普通排序的区别  /**    *个人网址: http://www.lipengfei2013.tk    * 功能:冒泡排序与普通排序的区别    */ package www.csdn ...

  2. nginx 1.4.7 发送日志到rsyslog

    <pre name="code" class="html">tar -xzf nginx-1.4.7.tar.gz # cd nginx-1.4.7 ...

  3. sonix uvc驱动的加入 RT5350支持H264

    依据sonix提供的驱动,须要在内核下进行配置,以加入到内核或与模块的方式进行编译: 1.makefile中加入驱动的文件夹,尽量保持和原有的一致, obj-$(CONFIG_USB_SN9C102) ...

  4. Duanxx 的 STM32 学习: 中断向量表操作

  5. 交换机VLAN研究

    这两天在研究openWRT的网络接口问题,涉及到了交换机的一些概念,主要是跟VLAN相关的,在此总结一下. VLAN在802.11Q中定义,802.11Q帧格式如下图所示: 交换机示意图如下图所示: ...

  6. python 序列(list,tuple,str)基本操作

    添加元素: mylist.append() mylist.extend([1, 2]) mylist.insert(1, "pos") 删除元素: mylist.remove(va ...

  7. ceph基本操作整理

    一.ceph基本操作: 启动osd.mon进程: start ceph-osd id=X start ceph-mon id=YYY 关闭osd.mon进程: stop  ceph-osd id=X ...

  8. 简单的web三层架构系统【第五版】

    接上一版,今天差不多就是三层架构后台代码的完结了,这一版写完,接下来就是前台的制作了,前台不太熟悉,还在深入学习.过一段时间在写,今天先把后台代码写完. 三层架构包括DAL层, BLL层, UI层(也 ...

  9. C#获取时间的函数

    //获取日期+时间DateTime.Now.ToString();            // 2012-9-4 20:02:10DateTime.Now.ToLocalTime().ToString ...

  10. ForeignKey.on_delete

    当由一个 ForeignKey 引用的对象被删除,默认情况下,Django模拟SQL的 ON DELETE CASCADE 来删除对象的 ForeignKey 关系.这样可以覆盖指定的 on_dele ...