
组合数学
文章平均质量分 79
小坏蛋_千千
im0qianqian_站在回忆的河边看着摇晃的渡船终年无声地摆渡,它们就这样安静地画下黄昏画下清晨......
展开
-
【组合数学】卡特兰数 / 大施罗德数 相关
【模板】超级卡特兰数/大施罗德数: https://www.acwing.com/blog/content/2273/卡特兰数和超级卡特兰数:https://www.cnblogs.com/gzy-cjoier/p/10394016.html原创 2020-08-30 14:53:34 · 766 阅读 · 0 评论 -
POJ 1026 Cipher (置换群)
Description Bob and Alice started to use a brand-new encoding scheme. Surprisingly it is not a Public Key Cryptosystem, but their encoding and decoding is based on secret keys. They chose the secret原创 2017-04-13 15:10:36 · 543 阅读 · 0 评论 -
山东省第八届 ACM 省赛 fireworks (组合数+逆元)
Description Hmz likes to play fireworks, especially when they are put regularly. Now he puts some fireworks in a line. This time he put a trigger on each firework. With that trigger, each firewo原创 2017-05-23 16:52:38 · 1027 阅读 · 0 评论 -
HDU 6044 Limited Permutation (组合数+逆元)
Description As to a permutation p1,p2,⋯,pn from 1 to n, it is uncomplicated for each 1≤i≤n to calculate (li,ri) meeting the condition that min(pL,pL+1,⋯,pR)=pi if and only if li≤L≤i≤R≤ri for each 1≤L原创 2017-07-30 12:54:40 · 647 阅读 · 0 评论 -
BZOJ 2301 [HAOI2011]Problem b (莫比乌斯反演)
Description 对于给出的 nn 个询问,每次求有多少个数对 (x,y)(x,y) ,满足 a≤x≤b,c≤y≤da≤x≤b,c≤y≤d ,且 gcd(x,y)=k\gcd(x,y) = k ,gcd(x,y)\gcd(x,y) 函数为 xx 和 yy 的最大公约数。 Input 第一行一个整数 nn ,接下来 nn 行每行五个整数,分别表示 a、b、c、d、ka、b、c、d、k原创 2017-08-04 15:07:42 · 374 阅读 · 0 评论 -
POJ 2154 Color (Polya + 欧拉函数)
Description Beads of N colors are connected together into a circular necklace of N beads (N<=1000000000). Your job is to calculate how many different kinds of the necklace can be produced. You should原创 2017-08-02 11:47:46 · 426 阅读 · 0 评论 -
POJ 2409 Let it Bead (Polya)
Description “Let it Bead” company is located upstairs at 700 Cannery Row in Monterey, CA. As you can deduce from the company name, their business is beads. Their PR department found out that customer原创 2017-04-05 13:14:54 · 637 阅读 · 0 评论 -
HDU 6129 Just do it (组合数)
Description There is a nonnegative integer sequence a1…n of length n. HazelFan wants to do a type of transformation called prefix-XOR, which means a1…n changes into b1…n, where bi equals to the XOR v原创 2017-08-16 17:48:39 · 364 阅读 · 0 评论 -
HDU 6143 Killer Names (容斥)
Description Galen Marek, codenamed Starkiller, was a male Human apprentice of the Sith Lord Darth Vader. A powerful Force-user who lived during the era of the Galactic Empire, Marek originated from t原创 2017-08-17 17:50:01 · 1678 阅读 · 15 评论 -
Codeforces 839 D. Winter is here (莫比乌斯反演)
Description Winter is here at the North and the White Walkers are close. John Snow has an army consisting of n soldiers. While the rest of the world is fighting for the Iron Throne, he is going to ge原创 2017-08-13 11:58:59 · 1529 阅读 · 0 评论 -
BZOJ 2440 [中山市选2011]完全平方数 (容斥)
Description 小 X 自幼就很喜欢数。但奇怪的是,他十分讨厌完全平方数。他觉得这些数看起来很令人难受。由此,他也讨厌所有是完全平方数的正整数倍的数。然而这丝毫不影响他对其他数的热爱。 这天是小X的生日,小 W 想送一个数给他作为生日礼物。当然他不能送一个小 X 讨厌的数。他列出了所有小 X 不讨厌的数,然后选取了第 K 个数送给了小 X 。小 X 很开心地收下了。原创 2017-08-06 20:37:53 · 499 阅读 · 0 评论 -
Codeforces 869 C. The Intriguing Obsession (组合数学)
Description With hands joined, go everywhere at a speed faster than our thoughts! This time, the Fire Sisters — Karen and Tsukihi — is heading for somewhere they’ve never reached — water-surrounded i原创 2017-10-07 15:47:52 · 1149 阅读 · 0 评论 -
51nod 1829 函数 (斯特林数)
Description 想知道f:A->B这个函数(其中|A|=n, |B|=m)的所有映射关系要使B的每个元素都要被A的一个元素覆盖到。 数字可能很大你只要输出方案数模1,000,000,007即可。 Input 一共一行两个数,n和m。(1<=n,m<=1,000,000) Output 一共一行包含一个方案数。 Input示例2 2 Output示例2 思路原题原创 2017-11-02 21:54:13 · 679 阅读 · 0 评论 -
LOJ 6160 二分图染色 (dp,组合数学)
题目描述 给定一个完全二分图,图的左右两边的顶点数目相同。我们要把图中的每条边染成红色、蓝色、或者绿色,并使得任意两条红边不共享端点、同时任意两条蓝边也不共享端点。计算所有满足条件的染色的方案数,并对 109+7109+710^9+7 取模。 输入格式 二分图单边的顶点数目 nnn 。 输出格式 输出一个整数,即所求的答案。...原创 2018-04-06 21:56:38 · 973 阅读 · 0 评论 -
POJ 3270 Cow Sorting (置换群)
Description Farmer John’s N (1 ≤ N ≤ 10,000) cows are lined up to be milked in the evening. Each cow has a unique “grumpiness” level in the range 1…100,000. Since grumpy cows are more likely to damag原创 2017-04-12 21:46:58 · 627 阅读 · 0 评论 -
POJ 1286 Necklace of Beads (Polya)
Description Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repetitions that are produced by rotation around the center of the circula原创 2017-04-12 12:51:44 · 592 阅读 · 0 评论 -
UVA 11538:Chess Queen
Chess QueenYou probably know how the game of chess is played and how chess queen operates. Two chess queens are in attacking position when they are on same row, column or diagonal of a chess board原创 2016-05-06 19:45:57 · 954 阅读 · 0 评论 -
UVA 11401:Triangle Counting
Triangle Counting You are given n rods of length 1, 2…, n. You have to pick any 3 of them & build a triangle. How many distinct triangles can you make? Note that, two triangles will be co原创 2016-05-06 19:55:28 · 742 阅读 · 0 评论 -
前100个卡特兰数
留作备用string catalan[]={ "1", "2", "5", "14", "42", "132", "429", "1430", "4862", "16796", "58786", "208012", "742900", "2674440", "9694845原创 2016-09-28 20:38:52 · 4235 阅读 · 0 评论 -
HDU 2841:Visible Trees (容斥原理)
Visible TreesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2796 Accepted Submission(s): 1222Problem DescriptionThere are ma原创 2016-09-29 21:01:02 · 558 阅读 · 0 评论 -
HDU 3037:Saving Beans(Lucas定理)
Saving BeansTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4540 Accepted Submission(s): 1788Problem DescriptionAlthough wint原创 2016-10-31 09:14:02 · 500 阅读 · 0 评论 -
HDU 4372:Count the Buildings (Stirling数)
Count the BuildingsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1300 Accepted Submission(s): 422Problem DescriptionThere a原创 2016-10-31 09:22:47 · 456 阅读 · 0 评论 -
POJ 2356:Find a multiple (鸽巢原理)
Find a multipleTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7743 Accepted: 3379 Special JudgeDescriptionThe input contains N natural (i.e. positi原创 2016-10-31 09:32:37 · 445 阅读 · 0 评论 -
POJ 3370:Halloween treats(鸽巢原理)
Halloween treatsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 8099 Accepted: 2950 Special JudgeDescriptionEvery year there is the same problem at原创 2016-10-31 09:47:49 · 423 阅读 · 0 评论 -
HDU 4135:Co-prime (容斥原理)
Co-primeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4289 Accepted Submission(s): 1698Problem DescriptionGiven a number N,原创 2016-11-01 21:35:17 · 494 阅读 · 0 评论 -
HDU 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): 7456 Accepted Submission(s): 2205Problem Descripti原创 2016-11-01 21:41:59 · 574 阅读 · 0 评论 -
HDU 4336 Card Collector (容斥原理||概率DP)
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,原创 2016-11-25 12:37:16 · 717 阅读 · 0 评论 -
POJ 1850 Code (组合数学)
Description 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 associa原创 2017-01-21 13:36:36 · 520 阅读 · 0 评论 -
POJ 1942 Paths on a Grid (组合数学)
Description 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)原创 2017-01-21 13:49:35 · 400 阅读 · 0 评论 -
HDU 2067:小兔的棋盘
小兔的棋盘Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8905 Accepted Submission(s): 4631Problem Description小兔的叔叔从外面旅游回来给她带来了一个礼原创 2016-05-10 13:19:16 · 1235 阅读 · 0 评论