
数学-----------组合数学
文章平均质量分 60
SingleK
这个作者很懒,什么都没留下…
展开
-
Uva 11401 - Triangle Counting(递推)
Triangle CountingYou are given n rods oflength 1, 2…,n. You have to pick any 3 of them & build a triangle. How many distincttriangles can you make? Note that, two triangles will be considered diff...原创 2017-11-07 23:06:33 · 300 阅读 · 0 评论 -
51Nod 1120 - 机器人走方格 V3(Lucas定理+Catalan数)
题目链接 http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1120【题目描述】N * N的方格,从左上到右下画一条线。一个机器人从左上走到右下,只能向右或向下走。并要求只能在这条线的上面或下面走,不能穿越这条线,有多少种不同的走法?由于方法数量可能很大,只需要输出Mod 10007的结果。Input输入一个数N(2...原创 2018-10-18 19:51:53 · 156 阅读 · 0 评论 -
ZOJ 3557 - How Many Sets II(Lucas定理模板)
题目链接 https://cn.vjudge.net/problem/ZOJ-3557【题意】从n个相同小球中取m个小球,不能取相邻的小球的方案数【思路】首先拿出 mmm 个小球,还剩下 n−mn-mn−m 个小球。这 n−mn-mn−m 个小球一共有 n−m+1n-m+1n−m+1 个空(左右两边也可以),把这 mmm 个小球插入到这 n−m+1n-m+1n−m+1 个空里就是答案,即A...原创 2018-10-18 19:34:27 · 172 阅读 · 0 评论 -
51Nod 1678 - lyk与gcd(分解因子+容斥)
题目链接 https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1678【题目描述】 这天,lyk又和gcd杠上了。 它拥有一个nnn个数的数列,它想实现两种操作。 1:将 aiaia_i 改为 bbb 2:给定一个数i,求所有 gcd(i,j)=1gcd(i,j)=1gcd(i,j)=1 时的 ajaja_j...原创 2018-09-02 20:42:22 · 179 阅读 · 0 评论 -
Catalan数总结
参考维基百科 Catalan数详解 这里只是把常见的公式搬过来设Catalan数的第n项为 hnhnh_n,定义 h0=h1=1h0=h1=1h_0=h_1=1 则有如下两个常用递推式 hn=h0hn−1+h1hn−2+...+hn−1h0,n>=2hn=h0hn−1+h1hn−2+...+hn−1h0,n>=2h_n=h_0h_{n-1}+h_1h_{n-2}+...+h_{...原创 2018-08-23 13:29:39 · 166 阅读 · 0 评论 -
UVA 11076 - Add Again(计数+可重排列)
题目链接 https://cn.vjudge.net/problem/UVA-11076【题意】 输入n个数字,1<=n<=12,这些数字组成的任何一个排列都是一个整数,你的任务是求出所有这些整数的和,多组输入,数据组数不超过20000组【思路】 n个数字每个数字出现在每一位上的次数是相等的,如果n个数字都不重复的话,那么总共有n!种排列情况,每个数字在每一位都出现(n-1...原创 2018-06-25 23:08:57 · 210 阅读 · 0 评论 -
51Nod 1119 - 机器人走方格 V2(组合数+逆元)
题目链接 https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1119M * N的方格,一个机器人从左上走到右下,只能向右或向下走。有多少种不同的走法?由于方法数量可能很大,只需要输出Mod 10^9 + 7的结果。Input 第1行,2个数M,N,中间用空格隔开。(2 <= m,n <= 100000...原创 2018-05-08 20:32:33 · 283 阅读 · 0 评论 -
51Nod 1305 - Pairwise Sum and Divide(思维)
题目链接 http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1305【题目描述】 有这样一段程序,fun会对整数数组A进行求值,其中Floor表示向下取整:fun(A) sum = 0 for i = 1 to A.length ...原创 2018-03-09 22:27:23 · 165 阅读 · 0 评论 -
Uvalive 4123 - Glenbow Museum(思维)
The famous Glenbow Museum in Calgary isWestern Canada’s largest museum, with exhibits ranging from art to culturalhistory to mineralogy. A brand new section is being planned, devoted tobrilliant compu...原创 2017-12-23 11:19:32 · 367 阅读 · 0 评论 -
Uva 11174 - Stand in a Line(思维+逆元)
All the people in the byteland want tostand in a line in such a way that no person stands closer to the front of theline than his father. You are given the information about the people of thebyteland....原创 2017-11-22 23:27:36 · 334 阅读 · 0 评论 -
Uva 11806 - Cheerleaders(计数)
In most professional sporting events,cheerleaders play a major role in entertaining the spectators. Theirroles aresubstantial during breaks and prior to start of play. The world cup soccer isno excep...原创 2017-11-09 22:49:55 · 218 阅读 · 0 评论 -
计蒜客 - 三值排序
时间限制 1000ms 内存限制 65536K题目描述排序是一种很频繁的计算任务。一个实际的例子是,当我们给某项竞赛的优胜者按金银铜牌排序的时候。在这个任务中可能的值只有三种1,2和3。我们用交换的方法把他排成升序的。写一个程序计算出,计算出的一个包括1、2、3三种值的数字序列,排成升序所需的最少交换次数。输入第1行为类别的数量N(1≤N≤1000)输入第2行到第N+1行,每行包括一个数字(1或2...原创 2017-10-23 23:08:58 · 745 阅读 · 0 评论 -
51Nod 1161 - Partial Sums(组合数找规律)
题目链接 http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1161【题目描述】给出一个数组A,经过一次处理,生成一个数组S,数组S中的每个值相当于数组A的累加,比如:A = {1 3 5 6} =&gt; S = {1 4 9 15}。如果对生成的数组S再进行一次累加操作,{1 4 9 15} =&gt; {1 5 1...原创 2018-10-23 10:27:54 · 227 阅读 · 0 评论