摘要: 题目链接:http://poj.org/problem?id=3128 题意:给定一个置换,求是否能由另一个置换平方后组成。 简单的性质,只要所给的置换中相等的偶数长度循环个数为偶数个就是可行解。 1 //STATUS:C++_AC_0MS_196KB 2 #include<stdio.h> 3 #include<stdlib.h> 4 #include<string.h> 5 #include<math.h> 6 #include<iostream> 7 #include<string> 8 #include<al 阅读全文
posted @ 2013-04-13 20:37 zhsl 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=1721 置换群的分数幂运算,分数幂运算考虑的是置换的合并,但这道题简化了很多,首先注意到“Alice first writes down all the numbers from 1 to N in some random order: a1, a2, ..., aN. Then she arranges the cards so that the position ai holds the card numbered ai+1, for every 1 <= i <= N-1, while the position 阅读全文
posted @ 2013-04-13 19:28 zhsl 阅读(428) 评论(0) 推荐(1) 编辑
摘要: 题目链接:http://poj.org/problem?id=1282 终于把这道题目给A了。 先来看看特殊情况:如果p=1的话,那就很容易做了,直接求每个循环节的长度,然后再求最小公倍数就行了。但是p!=1呢?如果依葫芦画瓢,通过n个置换去找循环节,然后再去求最小公倍数,那么难点就在找循环节上,很难处理,因此考虑换一种方法。 NOI2005论文,潘震皓的<置换群快速幂运算研究与探讨>上有详细介绍,主要是对置换进行一个变化,然后去枚举答案。 1 //STATUS:C++_AC_0MS_452KB 2 #include<stdio.h> 3 #include<std 阅读全文
posted @ 2013-04-13 13:25 zhsl 阅读(502) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=2407 欧拉函数模板题目: phi(n)=n*(1-1/p1)*(1-1/p1)*...*(1-1/pn)。 1 //STATUS:C++_AC_0MS_152KB 2 #include<stdio.h> 3 #include<stdlib.h> 4 #include<string.h> 5 #include<math.h> 6 #include<iostream> 7 #include<string> 8 #include<algorithm> 阅读全文
posted @ 2013-04-13 13:07 zhsl 阅读(209) 评论(0) 推荐(0) 编辑