HDU 4350 Card】的更多相关文章

打表找规律,比赛应付了一下,其实还可以把内存再优化一半掉,下面的0都是手动填充的,可以优化掉 题意: T个测试数据 下面52个数字表示 从栈顶到栈底的52个数 n l r表示 从栈顶下数 [l,r] 这个区间的数都放到栈顶 这样n次操作后的结果 这里可以猜想 n 操作应该是有重复的,也就是取模 n%MOD , MOD是个关于 l ,r 的表达式 省时间就直接打表了 #include<stdio.h> int s1[53],s2[53],st2; void outstack(int l,int…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4336 Card Collector Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) 问题描述 In your childhood, do you crazy for collecting the beautiful cards in the snacks? They said that,…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4336 题目大意:有n种卡片,需要吃零食收集,打开零食,出现第i种卡片的概率是p[i],也有可能不出现卡片.问你收集齐n种卡片,吃的期望零食数是多少? 状态压缩:f[mask],代表收集齐了mask,还需要吃的期望零食数. 打开包装,有3种情况,第一种:没有卡片,概率(1-sigma(p[i])) 第二种,在已知种类中:概率sigma(p[j]) 第三种,在未知种类中:p[k] 因此 f[mask]…
题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=4336 题意简单,直接用容斥原理即可 AC代码: #include <iostream> #include <cstdio> #include <cstring> #include <string> #include <cstdlib> #include <cmath> #include <vector> #include &…
Problem Description There are x cards on the desk, they are numbered from 1 to x. The score of the card which is numbered i(1<=i<=x) is i. Every round BieBie picks one card out of the x cards,then puts it back. He does the same operation for b round…
Problem Description In your childhood, people in the famous novel Water Margin, you will win an amazing award. As a smart boy, you notice that to win the award, you must buy much more snacks than it seems to be. To convince your friends not to waste…
题目:点击打开链接 题意:两个人纸牌游戏,牌大的人得分.牌大:2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < T < J < Q < K < A .值一样看花色, hearts (红心) > spades (黑桃) > diamond (方块) > clubs (梅花).问Eve 能得多少分.(每次得1分) 分析:将Eve的每张牌与Adam的所有牌比较,与所有比这张牌小的Adam的牌连边. 然后求最大…
Card Collector Problem Description In your childhood, do you crazy for collecting the beautiful cards in the snacks? They said that, for example, if you collect all the 108 people in the famous novel Water Margin, you will win an amazing award.  As a…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4336 点集中最早出现的元素的期望是 min ,最晚出现的元素的期望是 max :全部出现的期望就是最晚出现的元素的期望. #include<cstdio> #include<cstring> #include<algorithm> #define db double using namespace std; ,M=(<<)+; int n,ct[M],bin[N];…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5159 题解: 考虑没一个数的贡献,一个数一次都不出现的次数是(x-1)^b,而总的排列次数是x^b,所以每一个数有贡献的次数都是x^b-(x-1)^b,所以最后推导的公式就是: (x^b-(x-1)^b)*(1+2+...+x)/(x^b)=(1-((x-1)/x)^b)*(1+x)*x/2 代码: #include<iostream> #include<cstdio> #inclu…