
组合数学
xuanweiace
一个热爱算法竞赛的弱校ACMer路过。青大本,浙大硕,方向后端开发,菜鸡一枚,奋斗ing...
展开
-
【HDU - 1085 】Holding Bin-Laden Captive! (母函数)
题干:We all know that Bin-Laden is a notorious terrorist, and he has disappeared for a long time. But recently, it is reported that he hides in Hang Zhou of China!“Oh, God! How terrible! ”Don’...原创 2018-08-30 21:25:29 · 202 阅读 · 0 评论 -
【牛客 - 181F】子序列(容斥,组合数,费马小定理)
题干:题目描述给出一个长度为n的序列,你需要计算出所有长度为k的子序列中,除最大最小数之外所有数的乘积相乘的结果 输入描述:第一行一个整数T,表示数据组数。对于每组数据,第一行两个整数N,k,含义如题所示接下来一行N个整数,表示给出的序列保证序列内的数互不相同输出描述:对于每组数据,输出一个整数表示答案,对取模每组数据之间以换行分割 示例...原创 2019-02-19 11:51:35 · 301 阅读 · 0 评论 -
【CodeForces - 1084C】The Fair Nut and String(思维,组合数学)
题干:The Fair Nut found a string ss. The string consists of lowercase Latin letters. The Nut is a curious guy, so he wants to find the number of strictly increasing sequences p1,p2,…,pkp1,p2,…,pk, suc...原创 2018-12-11 16:13:53 · 887 阅读 · 0 评论 -
【牛客 - 303H第十五届浙江大学宁波理工学院程序设计大赛(同步赛)】Protoss and Zerg(快速幂取模,组合数学)
题干: 1v1,是星际争霸(StarCraft)中最常见的竞技模式。 tokitsukaze进行了n场1v1。在每一场的1v1中,她都有星灵(Protoss)和异虫(Zerg)两个种族可以选择,分别有a个单位和b个单位。因为tokitsukaze不太擅长玩人类(Terran),所以她肯定不会选择人类。 对于每一场1v1,玩家只能控制己方单位。也就是说,如果选择虫族,那么只能控...原创 2018-12-09 10:40:25 · 544 阅读 · 1 评论 -
【 HDU - 5363】Key Set(水题,快速幂,组合数学)
题干:soda has a set SS with nn integers {1,2,…,n}{1,2,…,n}. A set is called key set if the sum of integers in the set is an even number. He wants to know how many nonempty subsets of SS are key set....原创 2018-11-12 20:46:26 · 334 阅读 · 0 评论 -
【POJ - 1942 】Paths on a Grid (组合数学,求组合数的无数种方法)
题干:Imagine you are attending your math lesson at school. Once again, you are bored because your teacher tells things that you already mastered years ago (this time he's explaining that (a+b) 2=a 2+2...原创 2018-11-08 16:18:58 · 436 阅读 · 0 评论 -
【POJ - 1850】Code (组合数学,字符串另类排序)
题干:Transmitting and memorizing information is a task that requires different coding systems for the best use of the available space. A well known system is that one where a number is associated to a...原创 2018-11-08 11:49:40 · 307 阅读 · 0 评论 -
【HDU - 2200】Eddy's AC难题(简单组合数学)
题干:Eddy是个ACMer,他不仅喜欢做ACM题,而且对于Ranklist中每个人的ac数量也有一定的研究,他在无聊时经常在纸上把Ranklist上每个人的ac题目的数量摘录下来,然后从中选择一部分人(或者全部)按照ac的数量分成两组进行比较,他想使第一组中的最小ac数大于第二组中的最大ac数,但是这样的情况会有很多,聪明的你知道这样的情况有多少种吗? 特别说明:为了问题的简化,我们这里假...原创 2018-11-05 22:01:51 · 292 阅读 · 0 评论 -
*【CodeForces - 214D 】Numbers (dp,组合数学)
题干:Furik loves writing all sorts of problems, especially such that he can't solve himself. You've got one of his problems, the one Furik gave to Rubik. And Rubik asks you to solve it.There is inte...原创 2018-11-02 16:37:18 · 371 阅读 · 0 评论 -
【POJ - 1664】放苹果 (递归经典题 或 dp 或 母函数)
题干:把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。Input第一行是测试数据的数目t(0 <= t <= 20)。以下每行均包含二个整数M和N,以空格分开。1<=M,N<=10。Output对输入的每组数据M和N,用一行输出相应的K。Sample Input...原创 2018-11-09 22:19:55 · 527 阅读 · 3 评论 -
【URAL - 1114 】Boxes (dp,组合数学)
题干:Nboxes are lined up in a sequence (1 ≤N≤ 20). You haveAred balls andBblue balls (0 ≤A≤ 15, 0 ≤B≤ 15). The red balls (and the blue ones) are exactly the same. You can place the balls in...原创 2018-11-03 11:18:39 · 495 阅读 · 0 评论 -
*【HDU - 6333】Problem B. Harvest of Apples (莫队,逆元,组合数学)(这样预处理正确吗?)
题干:There are nn apples on a tree, numbered from 11 to nn. Count the number of ways to pick at most mm apples. InputThe first line of the input contains an integer TT (1≤T≤105)(1≤T≤105) denoting...原创 2018-10-08 00:54:34 · 325 阅读 · 0 评论 -
【qduoj - 纳新题】小明的dp(快速幂 + 乘法原理)(简单组合数学)
题干:描述 小明有n种珠宝,每种无限个,他想从这些珠宝中取出m个,编成手链(长链哦),并按顺序排列起来,为了好看,相邻的珠宝不能相同。小明想知道有多少种排列的方法。输入 第一行一个整数t代表样例个数第二行有两个正整数m,n。1 ≤ m, n ≤ 1000输出 第一行一个整数,表示在n种珠宝中取出m个的排列方案数模1000000007后的值输入样例 1 ...原创 2018-09-22 20:09:46 · 6454 阅读 · 2 评论 -
知识点 组合数学 卡特兰数
关于卡特兰数卡特兰数是一种经典的组合数,经常出现在各种计算中,其前几项为 : 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845, 35357670, 129644790, 477638700, 1767263190, 656412...转载 2018-09-27 22:53:29 · 579 阅读 · 0 评论 -
【HDU - 1465 】不容易系列之一 (组合数学,错排)
题干:大家常常感慨,要做好一件事情真的不容易,确实,失败比成功容易多了! 做好“一件”事情尚且不易,若想永远成功而总从不失败,那更是难上加难了,就像花钱总是比挣钱容易的道理一样。 话虽这样说,我还是要告诉大家,要想失败到一定程度也是不容易的。比如,我高中的时候,就有一个神奇的女生,在英语考试的时候,竟然把40个单项选择题全部做错了!大家都学过概率论,应该知道出现这种情况的概率,所以至今我都...原创 2018-09-06 17:28:29 · 357 阅读 · 0 评论 -
【HDU - 1220】Cube (组合数学,简单)
题干:Cowl is good at solving math problems. One day a friend asked him such a question: You are given a cube whose edge length is N, it is cut by the planes that was paralleled to its side planes into...原创 2018-09-05 11:09:59 · 323 阅读 · 0 评论