![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
组合数
mmk27
这个作者很懒,什么都没留下…
展开
-
Gym - 100548F Color 组合数+容斥
题意:给你N朵花,M种颜料(n,m<=1e9),要求给所有花染色,且相邻的花不能用同样的颜色,求出最后恰好用了k种颜料的方案数(k<=1e5)题解:当我们用至少k中染色的时候 f[k] = k*(k-1)^(n-1) 其中包括了 至少k-1中的,我们需要减去C(k,k-1)*f[k-1] ,但是很明显我们多减了一次至少f[k-2]次的,举个栗子:假设有1 2 3 4 5,我...原创 2018-10-30 14:28:21 · 194 阅读 · 0 评论 -
ZOJ - 3955 Saddle Point 枚举 + 组合数
点击查看:点击查看题意:给你一个矩阵,可以删去任意行,任意列,一共有(2^n - 1) * (2^m - 1) 种矩阵,问有多少位置符合,在这一行最小且唯一,在这一列中最大且唯一。题解:枚举每个位置,看看这行有多少比他大的数p1,这列有多少比他小的数p2,当这个数符合条件的种数即为2^p1 * 2^p2 种#include <bits/stdc++.h>using na...原创 2019-04-05 13:10:07 · 90 阅读 · 0 评论 -
Gym - 101972I Secret Project 组合数+思维
There are n students working on a secret project, this project is very important and unique, so they decided to keep it safe, and protect it from leakage.The students will put all the project's docu...原创 2018-12-16 12:14:36 · 535 阅读 · 0 评论 -
CodeChef - ZUBRIDER Club of Riders 数学 组合数
At a shopping mall, every now and then, a naughty kid steals some chocolates from different chocolate shops and runs away. The guards in the shopping mall were unable to catch the kid as he has got a ...原创 2018-12-19 22:48:31 · 257 阅读 · 0 评论 -
CodeForces - 288B Polo the Penguin and Houses
Little penguin Polo loves his home village. The village has n houses, indexed by integers from 1 to n. Each house has a plaque containing an integer, the i-th house has a plaque containing integer pi ...原创 2018-11-26 20:50:06 · 160 阅读 · 0 评论 -
CodeForces - 232B Table 背包的味道+组合数
John Doe has an n × m table. John Doe can paint points in some table cells, not more than one point in one table cell. John Doe wants to use such operations to make each square subtable of size n × n ...原创 2018-11-08 17:26:00 · 186 阅读 · 0 评论 -
组合数总结
转自:国特震哥 点击查看链接对于求C(n,m) 1.如果是对于小范围内的n和m(不是很难)就不说了 差不多用java的大数就可以了 2.当n在1e10^5范围左右,往往是会有取模,设这个数为mod(往往mod为质数,这个很重要)。 既然是组合数,就免不了有阶乘的部分, n 的范围在10^5的数量级,所以完全可以线性扫一遍,用一个fac数组存i的阶乘对mod取模即可, 但是对于除法取...转载 2018-11-07 10:26:24 · 331 阅读 · 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+2ab+b ...原创 2018-11-06 22:13:16 · 133 阅读 · 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 char...原创 2018-11-06 22:09:48 · 123 阅读 · 0 评论 -
吉首大学2019年程序设计竞赛(重现赛)
题目链接:https://ac.nowcoder.com/acm/contest/992#question链接:https://ac.nowcoder.com/acm/contest/992/A来源:牛客网A、SARS病毒时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld题目描述目...原创 2019-07-14 17:12:44 · 924 阅读 · 0 评论