HDU 4986 Little Pony and Alohomora Part I
题目链接
题意:一些钥匙随机放在箱子里,现在问打开次数期望
思路:每种方式相当于一个置换的循环个数,那么考虑f[i]为i个箱子的情况,f[i + 1]要么就是放在最后多一个循环,要么就是插入中间循环个数不变,对应的转移为f[i + 1] = (f[i] + 1) / i + f[i] * (i -...
分类:
其他好文 时间:
2014-09-01 15:38:53
阅读次数:
196
Little Pony and Permutation
Problem Description
As a unicorn, the ability of using magic is the distinguishing feature among other kind of pony. Being familiar with composition and dec...
分类:
其他好文 时间:
2014-09-01 10:50:33
阅读次数:
208
A(hdu4985) - Little Pony and Permutation 1 #include 2 3 using namespace std; 4 5 #define NN 100010 6 int g[NN], f[NN]; 7 8 int main(void) 9 {10...
分类:
其他好文 时间:
2014-08-31 22:54:32
阅读次数:
210
递推。设n个盒子的Spell次数为S(n),期望为E(n)。当有n个盒子时,可能第n把钥匙在第n个盒子中,此时的Spell次数应该为(n-1)!+S(n-1);当第n把钥匙不在第n个盒子中,混合排列,此时的Spell次数为(n-1)*S(n-1),因此,期望E(n) = S(n)/n!,S(n) =...
分类:
其他好文 时间:
2014-08-31 22:37:21
阅读次数:
190
水题。 1 #include 2 3 #define MAXN 100005 4 5 int buf[MAXN], n; 6 7 int main() { 8 int i, j, k; 9 10 while (scanf("%d", &n) != EOF) {11 ...
分类:
其他好文 时间:
2014-08-31 22:36:31
阅读次数:
220
#coding:utf-8
BUTTON = 'button' # 庄稼?????
L_BLIND = 'little_blind' # 小盲注
B_BLIND = 'big_blind' # 小盲注
SEAT = 'seat'
HOLD = 'hold' # 手牌
ASK = 'ask' # ?????
FIRST= 'first' # 第一次发三张牌...
分类:
其他好文 时间:
2014-08-30 02:25:08
阅读次数:
237
J -Phage War Time Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64u Phage War is a little flash game. In...
分类:
其他好文 时间:
2014-08-29 21:23:28
阅读次数:
304
function?Bird(name,?age)?{
????this.name?=?name;
????this.age?=?age;
????this.sons?=?["Tom",?"John"];
????//在sayName()方法不存在的情况下,添加到原型中
????if?(typeof...
分类:
其他好文 时间:
2014-08-28 13:28:29
阅读次数:
166
递推...
Little Tiger vs. Deep Monkey
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)
Total Submission(s): 661 Accepted Submission(s): 244
Problem Des...
分类:
其他好文 时间:
2014-08-28 11:28:29
阅读次数:
269
Problem Description
Last night, little erriyue had a horrible nightmare. He dreamed that he and his girl friend were trapped in a big maze separately. More terribly, there are two ghosts in the maz...
分类:
Web程序 时间:
2014-08-27 22:03:18
阅读次数:
255