题意:小球排成一排,从m种颜色中选取k种颜色给n个球上色,要求相邻的球的颜色不同,求可行的方案数,答案模1e9+7.T组数据,1<= n, m <= 1e9, 1 <= k <= 1e6, k <= n, m 分析: a(k)表示用不超过k种颜色染n个位置,两两相邻颜色不相同的总数,很简单a(k)=k(n-1)^(k-1) b(k)表示恰好用k种颜色 很显然a(k)=ΣC(k,i)b(i),我们知道a,想知道b,这里就用到二项式反演 那么b(k)=ΣC(k,i)*i*(-1)…
A http://acm.hdu.edu.cn/showproblem.php?pid=5070 先跳过. B http://acm.hdu.edu.cn/showproblem.php?pid=5071 维护一个聊天队列,有8种操作,每次操作完要打印对应的信息,认真读题,按题意模拟,一维数组模拟队列就可以,5000操作,交换删除等on暴力复杂度也不会超时. #include<cstdio> #include<cstring> #include<map> using n…
A Average Score http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5373 a班有n个人,b班有m个人,bob在a班,现在知道除了bob以外的所有人的成绩,还知道bob如果从a班转到b班,两个班的平均成绩都会提高,问bob合法的成绩区间. 解法,求一下两个班的平均成绩,bob的成绩肯定要比a班的小,比b班的大. #include<cstdio> int main(){ int t,n,m,x,sa,sb; w…
F - Detachment In a highly developed alien society, the habitats are almost infinite dimensional space. In the history of this planet,there is an old puzzle. You have a line segment with x units’ length representing one dimension.The line segment can…
周六周末组队训练赛. Dogs' Candies Time Limit: 30000/30000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 3920 Accepted Submission(s): 941 Problem Description Far far away, there live a lot of dogs in the forest. Unlike…
http://blog.csdn.net/queuelovestack/article/details/53055418 下午重现了一下大连赛区的比赛,感觉有点神奇,重现时居然改了现场赛的数据范围,原本过的人数比较多的题结果重现过的变少了,而原本现场赛全场过的人最少的题重现做出的人反而多了一堆,不过还是不影响最水的6题,然而残酷的现实是6题才有机会拿铜...(╥╯^╰╥) 链接→2016ACM/ICPC亚洲区大连站-重现赛 Problem 1001 Wrestling Match Accept…
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=5558 Problem Description Alice wants to send a classified message to Bob. She tries to encrypt the message with her original encryption method. The message is a string S, which consists of Nlowercase let…