![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ACM组合数学
桑榆207
在最终的结果到来之前,任何肯定会赢之类的话都是虚无缥缈的。
展开
-
hdu5698 瞬间移动(组合数取模&&卢卡斯定理&&快速幂)
有一个无限大的矩形,初始时你在左上角(即第一行第一列),每次你都可以选择一个右下方格子,并瞬移过去(如从下图中的红色格子能直接瞬移到蓝色格子),求到第nn行第mm列的格子有几种方案,答案对10000000071000000007取模。把这个方格填数:0 0 0 0 0 00 1 1 1 1 10 1 2 3 4 50 1 3 6 10 15发现和杨辉三角形有很大关系...原创 2018-08-14 17:03:05 · 199 阅读 · 0 评论 -
HDU 4810 Wall Painting 组合数+位运算
Ms.Fang loves painting very much. She paints GFW(Great Funny Wall) every day. Every day before painting, she produces a wonderful color of pigments by mixing water and some bags of pigments. On the K-...原创 2019-02-05 11:50:06 · 162 阅读 · 0 评论 -
HDU4000 Fruit Ninja利用树状数组计数+组合数学
http://acm.hdu.edu.cn/showproblem.php?pid=4000让找i<j<k,但是ai<ak<aj的数 Problem Description Recently, dobby is addicted in the Fruit Ninja. As you know, dobby is a free elf, so unl...原创 2019-01-24 10:10:46 · 174 阅读 · 0 评论 -
poj 3286 How many 0's?
题意:计算从[a,b]期间中总共有多少个0。博客参考:https://blog.csdn.net/hlmfjkqaz/article/details/10362311思路:比如1234,我们计算1到1234总共出现了多少个0,。当个位有0的时候,出现了123次当十位有0的时候,出现了12*10次当百位有0的时候,出现了1*100次但是若为1204,在计算十位0的个数的时候,是11...原创 2018-08-16 11:22:52 · 104 阅读 · 0 评论 -
HDU 2068 RPG的错排(错排公式 + 详解)
Problem Description 今年暑假杭电ACM集训队第一次组成女生队,其中有一队叫RPG,但做为集训队成员之一的野骆驼竟然不知道RPG三个人具体是谁谁。RPG给他机会让他猜猜,第一次猜:R是公主,P是草儿,G是月野兔;第二次猜:R是草儿,P是月野兔,G是公主;第三次猜:R是草儿,P是公主,G是月野兔;......可怜的野骆驼第六次终于把RPG分清楚了。由于RPG的带动,做ACM的...原创 2018-08-16 09:48:35 · 104 阅读 · 0 评论 -
HDU 2048神、上帝以及老天爷(错排阶乘)
Problem Description HDU 2006'10 ACM contest的颁奖晚会隆重开始了!为了活跃气氛,组织者举行了一个别开生面、奖品丰厚的抽奖活动,这个活动的具体要求是这样的:首先,所有参加晚会的人员都将一张写有自己名字的字条放入抽奖箱中;然后,待所有字条加入完毕,每人从箱中取一个字条;最后,如果取得的字条上写的就是自己的名字,那么“恭喜你,中奖了!”大家可...原创 2018-08-16 09:13:59 · 134 阅读 · 0 评论 -
HDU - 1134 Game of Connections(卡特兰数大数+JAVA)
This is a small but ancient game. You are supposed to write down the numbers 1, 2, 3, . . . , 2n - 1, 2n consecutively in clockwise order on the ground to form a circle, and then, to draw some straigh...原创 2018-08-14 22:15:13 · 133 阅读 · 0 评论 -
HDU 2049考新郎( 错排题+组合数学)
Problem Description 国庆期间,省城HZ刚刚举行了一场盛大的集体婚礼,为了使婚礼进行的丰富一些,司仪临时想出了有一个有意思的节目,叫做"考新郎",具体的操作是这样的:首先,给每位新娘打扮得几乎一模一样,并盖上大大的红盖头随机坐成一排;然后,让各位新郎寻找自己的新娘.每人只准找一个,并且不允许多人找一个.最后,揭开盖头,如果找错了对象就要当众跪搓衣板...看来做新郎...原创 2018-08-14 21:36:21 · 676 阅读 · 0 评论 -
HDU 4349 Xiao Ming's Hope (lucas定理的第二个结论)
Xiao Ming likes counting numbers very much, especially he is fond of counting odd numbers. Maybe he thinks it is the best way to show he is alone without a girl friend. The day 2011.11.11 comes. Seein...原创 2018-08-14 21:17:09 · 138 阅读 · 0 评论 -
求解组合数
求C(N,M)一开始利用lucas做,超时,直接做就过了。不能思维太惯性化。#include <cstdio>#include<iostream>#include <cstring>#include <math.h>typedef long long LL;LL ans,n,k;int main(){ while(s...原创 2018-08-14 17:46:21 · 127 阅读 · 0 评论 -
组合数学与卡特兰数
例如:1,2,5,14,42,132.....Cn表示长度2n的dyck word的个数。Dyck word是一个有n个X和n个Y组成的字串,且所有的前缀字串皆满足X的个数大于等于Y的个数。以下为长度为6的dyck words:XXXYYY XYXXYY XYXYXY XXYYXY XXYXYY将上例的X换成左括号,Y换成右括号,Cn表示所有包含n组括号的合法运算式的个数:((()...原创 2018-08-03 15:06:34 · 309 阅读 · 0 评论 -
Lucas定理计算c(m,n)%p
#include<bits/stdc++.h>using namespace std;#define ll long longlong long p=1,n,m;long long qpow(ll a, long long b, long long mod) { if(!a) return 0; int ans = 1; while(b) { ...原创 2018-08-04 19:28:29 · 380 阅读 · 0 评论 -
求解组合数取模
求C(N,M)%PP=1000000007;#include <iostream>#include <cstdio>#include <string>#include <cstring>#include <fstream>#include <algorithm>#include <cmath>原创 2018-08-14 17:09:50 · 114 阅读 · 0 评论 -
AtCoder Regular Contest 058--D - いろはちゃんとマス目 / Iroha and a Grid(数学+组合数逆元)
D - いろはちゃんとマス目 / Iroha and a GridTime Limit: 2 sec / Memory Limit: 256 MBScore :400400pointsProblem StatementWe have a large square grid withHHrows andWWcolumns. Iroha is now standing in...原创 2019-05-19 15:54:16 · 272 阅读 · 0 评论