
组合数学
文章平均质量分 85
码代码的猿猿的AC之路
人一我百,人十我万追逐青春的梦想,怀着自信的心,永不放弃
展开
-
XTUOJ 1168 填颜色
填颜色Acceteped : 1 Submit : 4Time Limit : 1000 MS Memory Limit : 65536 KB Description题目描述给你n个方格,m种颜色,要求相邻格和首尾格的颜色不同,请问有多少种不同的填涂方法。输入每行输出两个整数n和m,1≤n,m≤原创 2013-11-30 17:15:24 · 2746 阅读 · 0 评论 -
UVA 11181 Probability|Given 概率
Probability|GivenTime Limit: 3000MSMemory Limit: Unknown64bit IO Format: %lld & %lluSubmit StatusDescriptionProblem GProbability|GivenInput: Standard InputOutpu原创 2014-11-19 14:24:25 · 1266 阅读 · 0 评论 -
UVA 10491 Cows and Cars 概率
Cows and CarsTime Limit: 3000MSMemory Limit: Unknown64bit IO Format: %lld & %lluSubmit StatusDescriptionProblem HCows and CarsInput: standard inputOutput: stand原创 2014-11-19 13:17:28 · 907 阅读 · 0 评论 -
UVA 1636 Headshot 概率
HeadshotTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionYou have a revolver gun with a cylinder that has n chambe原创 2014-11-19 12:56:46 · 1145 阅读 · 0 评论 -
UVA 12034 Race
RaceTime Limit: 1000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescription Race Disky and Sooma, two of the bigg原创 2015-01-07 23:18:46 · 1162 阅读 · 0 评论 -
HDOJ 3232 Crossing Rivers 简单概率
简单期望:船到岸边时间的期望是 L/v 再过河的时间是L/v所以过每条河的时间期望是2*L/vCrossing RiversTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 699 Accepted Subm原创 2015-01-29 17:45:08 · 899 阅读 · 0 评论 -
UVA 10213 How Many Pieces of Land? 欧拉定理
欧拉定理 V-E+F=C+1Problem GHow Many Pieces of Land?Input: Standard InputOutput: Standard OutputTime Limit: 3 seconds You are given an elliptical shaped land and you are asked to ch原创 2015-02-02 00:34:54 · 2015 阅读 · 0 评论 -
UVALive 3720 Highways 组合数学
根据对称性只考虑 \ 的斜线枚举 \ 所在的边框的大小 a,b 只有在 gcd(a,b) 不为1的情况下才是不重复的直线有(n-a)*(m-b)个, 如果边框的左上点接着一个边框的右下点则是重复的直线 需要减去 max(n-2*a,0)*max(m-2*b,0)个重复的边框所以对于一个边长为a,b的边框来说 有 (n-a)*(m-b) - max(n-2*a,0)*max(m-2*b,原创 2015-02-03 16:18:37 · 1191 阅读 · 0 评论 -
Codeforces 520C. DNA Alignment 找规律
等价于一个不左移一个左移然后结果乘上n,也就是第二个串的每个字符都会和第一个串的某个字符配对一次,所以选择出现次数最多的字符更好.如果有多个字符出现次数都是最多的,结果为最多的字符种类数的n次方C. DNA Alignmenttime limit per test2 secondsmemory limit per test256原创 2015-03-02 23:30:45 · 2118 阅读 · 0 评论 -
HDOJ 1796 How many integers can you find 容斥原理
How many integers can you findTime Limit: 12000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4852 Accepted Submission(s): 1389Problem Descripti原创 2015-03-27 17:43:34 · 818 阅读 · 0 评论 -
HDOJ 4135 Co-prime 容斥原理
求得n的因数后,简单容斥Co-primeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1798 Accepted Submission(s): 685Problem Description原创 2015-03-27 20:05:05 · 1017 阅读 · 0 评论 -
HDOJ 5184 Brackets 卡特兰数扩展
既求从点(0,0)只能向上或者向右并且不穿越y=x到达点(a,b)有多少总走法...有公式: C(a+b,min(a,b))-C(a+b,min(a,b)-1) /// 折纸法证明卡特兰数: http://blog.sina.com.cn/s/blog_6917f47301010cno.htmlBracketsTime Limit: 2000/1000 MS原创 2015-03-19 00:30:42 · 1009 阅读 · 0 评论 -
BZOJ 1002: [FJOI2007]轮状病毒 递推/基尔霍夫矩阵树定理
f[n]=3*f[n-1]-f[n-2]+21002: [FJOI2007]轮状病毒Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 2959 Solved: 1644[Submit][Status][Discuss]Description给定n(NInput第一行有1个正整数n。Outp原创 2015-04-28 16:48:46 · 1591 阅读 · 0 评论 -
UVA 10294 Arif in Dhaka (First Love Part 2) Polya计数
题目链接Polya计数入门题10294 Arif in Dhaka (First Love Part 2)Our hero Arif is now in Dhaka (Look at problem 10244 – First Love if you want to know more about Arif, but that information is not necessary for th原创 2015-05-06 17:13:13 · 979 阅读 · 0 评论 -
UVALA 3641 Leonardo's Notebook
Polya定理应用: 题意:给出一个置换B,问有没有一个置换A,使得A^2=B。 思路:对于置换的循环节,比如(a1,a2,a3)和(b1,b2,b3,b4),那么对于奇数长度的循环节,发现进行两次乘法以后还是奇数长度,偶数长度的循环节分解为两个长度相同的循环节。那么就可以对B中的循环节进行判断,奇数长度的不同管,这个总能找到满足要求的,偶数循环节的数量也要是偶数,这样才能两两配原创 2015-05-06 22:08:13 · 1338 阅读 · 0 评论 -
BZOJ 1004: [HNOI2008]Cards Polya计数+DP
Polya计数+dp求满足对应循环的不动点有几个1004: [HNOI2008]CardsTime Limit: 10 Sec Memory Limit: 162 MBSubmit: 2046 Solved: 1212[Submit][Status][Discuss]Description小春现在很清闲,面对书桌上的N张牌,他决定给每张染色,目前小春原创 2015-05-07 13:48:46 · 876 阅读 · 0 评论 -
Codeforces 235B. Let's Play Osu!
235B - Let's Play Osu!Let us take a deep look in how this score is calculated. for a n long 'O' block, they contribute n2 to answer.Let us reformat this problem a bit and consider the foll原创 2014-09-03 20:33:39 · 1412 阅读 · 0 评论 -
HDOJ 4915 Multiplication table
可以特判出0和1,再统计每行出现了多少种十位上的数就可以了....没有考虑2的情况似乎也过了......Multiplication tableTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 800 A原创 2014-09-11 01:28:32 · 1373 阅读 · 0 评论 -
Codeforces 109 C. Lucky Tree
反面考虑,找到所有的边都不是Lucky digits的联通块,若块中的点有x个,则不是 triples 的数量为 :X*(X-1)*(X-2)-2LL*X*(X-1)*(n-X)C. Lucky Treetime limit per test2 secondsmemory limit per test256 megabytes原创 2014-09-10 23:52:55 · 1450 阅读 · 0 评论 -
SRM 599 DIV2 950
太弱了。。。。这么简单的题也只能比赛之后写。。。。。roblem Statement Fox Ciel has a list of names on her computer. In this problem, a name is simply a non-empty string of lowercase letters. All names in h原创 2013-12-06 20:55:57 · 1366 阅读 · 0 评论 -
CodeForces 374 B. Inna and Nine
B. Inna and Ninetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputInna loves digit 9 very much. That's why sh原创 2013-12-19 17:05:55 · 1435 阅读 · 0 评论 -
CodeForces 379 D. New Year Letter
枚举开头结尾的字母,枚举ac的个数,就两个Fibonacci数列的和。。。。。D. New Year Lettertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard ou原创 2014-01-06 10:21:11 · 1487 阅读 · 0 评论 -
SERC 2013 E Skyscrapers
http://acm.hunnu.edu.cn/online/?action=problem&type=show&id=11445E: SkyscrapersSkyscrapers is a pencil puzzle. It’s played on a square nxn grid. Each cell of the grid has a building原创 2014-03-17 21:29:19 · 1459 阅读 · 0 评论 -
SERC2013 B Nested Palindromes
http://acm.hunnu.edu.cn/online/?action=problem&type=show&id=11442&courseid=0B: Nested PalindromesPalindromes are numbers that read the same forwards and backwards. Your friend原创 2014-03-18 17:24:44 · 1858 阅读 · 0 评论 -
HDOJ 1261 字串数
JAVA大数....字串数Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2893 Accepted Submission(s): 679Problem Description一个A和两个B原创 2014-07-02 12:37:12 · 1161 阅读 · 0 评论 -
HDOJ 4869 Turn the pokers
最后的结果中正面向上的奇偶性是一定的,计算出正面向上的范围low,up结果即为 C(m,low)+ C(m,low+2) +.... + C(m,up) ,用逆元取模Turn the pokersTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total S原创 2014-07-23 21:47:43 · 981 阅读 · 0 评论 -
HDOJ 4865 Peter's Hobby
隐马尔可夫模型介绍见这里:点击打开链接Peter's HobbyTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 362 Accepted Submission(s): 160Problem De原创 2014-07-24 01:11:00 · 1386 阅读 · 0 评论 -
Codeforces 451 D. Count Good Substrings
D. Count Good Substringstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWe call a string good, if after me原创 2014-07-27 14:39:16 · 1195 阅读 · 0 评论 -
Codeforces 453 A. Little Pony and Expected Maximum
( k / n) ^ m - ( ( k - 1) / n ) ^ m连续扔m次都A. Little Pony and Expected Maximumtime limit per test1 secondmemory limit per test256 megabytesinputstandard input原创 2014-08-02 15:41:38 · 1212 阅读 · 0 评论 -
POJ 3252 Round Numbers
Round NumbersTime Limit: 2000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status] DescriptionThe cows, as you know, have no原创 2014-07-30 21:00:20 · 863 阅读 · 0 评论 -
HDOJ 4972 A simple dynamic programming problem
找规律。。。数据可能不合法。。。输出0A simple dynamic programming problemTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 85 Accepted Submission(s): 3原创 2014-08-21 18:44:58 · 1159 阅读 · 0 评论 -
HDOJ 3944 DP?
尽量沿着边走距离最短,化减后 C(n+1,k)+ n - k,预处理阶乘,Lucas定理组合数取模DP?Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 128000/128000 K (Java/Others)Total Submission(s): 1899 Accepted Submissi原创 2014-08-11 00:37:43 · 1191 阅读 · 0 评论 -
HDOJ 3037 Saving Beans
假设有n+1个树,第n+1个树埋不足m的种子,隔板法C【n+m】【m】大组合数取mod用Lucas定理:Lucas(n,m,p) = C[n%p][m%p] × Lucas(n/p,m/p,p) ;Saving BeansTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K原创 2014-08-10 17:57:57 · 1288 阅读 · 0 评论 -
Codeforces 128 C. Games with Rectangle
长宽是各自独立的,算出各自可以取的方法数后相乘....C. Games with Rectangletime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output原创 2014-09-10 14:36:21 · 1207 阅读 · 0 评论 -
BZOJ 1005: [HNOI2008]明明的烦恼 Purfer数列
Purfer数列:http://www.cnblogs.com/zhj5chengfeng/p/3278557.html题目大意 自从明明学了树的结构,就对奇怪的树产生了兴趣......给出标号为 1 到 N 的点,以及某些点最终的度数,允许在任意两点间连线,可产生多少棵度数满足要求的树? Input 第一行为原创 2015-05-07 17:07:36 · 1010 阅读 · 0 评论