Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the following unique perm...
分类:
其他好文 时间:
2014-11-22 20:11:58
阅读次数:
180
题目大意:求1~n的排列能组成多少种小根堆
考虑一个1~i的排列所构成的堆,l为左儿子大小,r为右儿子的大小
那么1一定是堆顶 左儿子和右儿子分别是一个堆 显然如果选出l个数给左儿子 那么左儿子的方案数显然是f[l],右儿子的方案数为f[r]
于是有f[i]=C(i-1,l)*f[l]*f[r]
于是我们线性筛处理出阶乘和阶乘的逆元 代入即可得到WA
原因是这题n可以大于p 此时要用到L...
分类:
其他好文 时间:
2014-11-21 16:21:39
阅读次数:
156
http://www.lydsy.com/JudgeOnline/problem.php?id=1072首先无限膜拜题解orz表示只会暴力orz数据那么小我竟然想不到状压!orz这种题可以取模设状态orzf[i,j]表示状态为i,mod d为j的方案则答案为f[all, 0]转移就太简单了orzf[...
分类:
其他好文 时间:
2014-11-20 15:15:59
阅读次数:
274
Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the following unique perm...
分类:
其他好文 时间:
2014-11-13 06:59:23
阅读次数:
166
题目1072: [SCOI2007]排列permTime Limit:10 SecMemory Limit:162 MBDescription给一个数字串s和正整数d, 统计s有多少种不同的排列能被d整除(可以有前导0)。例如123434有90种排列能被2整除,其中末位为2的有30种,末位为4的有6...
分类:
其他好文 时间:
2014-11-05 12:21:20
阅读次数:
169
On GNU versions of find you can use -executable:find . -type f -executable -printFor BSD versions of find, you can use -perm with + and an octal mask:...
分类:
其他好文 时间:
2014-10-27 12:42:58
阅读次数:
231
全排列是非常常用的一个小算法,下面是n个整数全排列的递归实现,使用的是C++
#include
using namespace std;
int n = 0;
void swap(char *a ,char *b)
{
int m ;
m = *a;
*a = *b;
*b = m;
}
void perm(char list[],int k, int m )
{
int...
分类:
编程语言 时间:
2014-10-27 10:58:40
阅读次数:
208
题目大意:给定n个数字,求这些数字的全排列中有多少数能被d整除
令f[i][j]为状态为i,余数为j的方案数
枚举最高位转移
小心爆int
#include
#include
#include
#include
using namespace std;
int n,d,ans,f[1<<10][1<<10],digit[1<<10],tens[10],cnt[10],factorial[1...
分类:
其他好文 时间:
2014-10-16 10:38:52
阅读次数:
131
普通用户登录:bash: /dev/null:Permissiondenied2012-12-07 16:01:36|分类:linux|举报|字号订阅Last login: Fri Dec 7 15:29:17 2012 from 124.42.29.118-bash: /dev/null:Perm...
分类:
其他好文 时间:
2014-10-14 14:47:48
阅读次数:
222
package oj.lin;public class quanpailie { public static void main(String[] args) { char buf[]={'a','b','c'}; perm(buf,0,buf.length-1...
分类:
其他好文 时间:
2014-10-10 14:19:14
阅读次数:
203