摘要:
这是一道简单的置换群的问题;View Code #include<iostream> #include<cstdio> #include<cstdlib> #include<algorithm> #include<cmath> #include<queue> #include<set> #include<map> #include<cstring> #include<vector> #include<string> #define LL long long usi 阅读全文
posted @ 2012-09-15 20:55
wutaoKeen
阅读(108)
评论(0)
推荐(0)
摘要:
题意:有一条从1~n的单向高速路,现在要你修建两单向路条路,使任何一个点可以到任何的点,求这两天的路最短;注意:起始中点要不同;我们知道要满足条件,那么我们就必定使1~n有通路,我们可以从1~n修一条路,在从n-3条边选出最短的边就可以了;这里为什么是从n-3条边里选,这里我们要去掉两个端点的边;例如:n=4 时 4 7 9,这里答案是12而不是11;View Code #include<iostream> #include<cstdio> #include<cstdlib> #include<algorithm> #include<cma 阅读全文
posted @ 2012-09-15 20:43
wutaoKeen
阅读(242)
评论(0)
推荐(0)
摘要:
这是一道置换+DP的的题目;题意是要你把每一个置换都可以分解成若干个轮换,那么这些轮换的阶的最小公倍数就是该置换的阶。这里要我们求怎样分解使最小公倍数最大,并且使置换排序最小;怎样求最大的最小的公倍数,这里我们用DP的方法可以容易求出;dp[i][j]表示i分解成j个数;排序就只要对因子进行排序就可以了(自己写一下就知道了)在进行输出;View Code #include<iostream> #include<cstdio> #include<cstdlib> #include<algorithm> #include<cmath> # 阅读全文
posted @ 2012-09-15 19:06
wutaoKeen
阅读(293)
评论(0)
推荐(0)