组合数学
凌晨四点的洛杉矶fly
这个作者很懒,什么都没留下…
展开
-
D - いろはちゃんとマス目 / Iroha and a Grid(组合数学)
题目链接:https://atcoder.jp/contests/arc058/tasks/arc058_b 题意: 给你一个n*m的网格,该网格的左下角的a*b的网格不能走,求从(1,1)到(n,m)有多少种走法(结果模上1e9) 思路:先从(1,1)走到(n-a,i)(i从b+1到m)然后再往下走一步(这里不能再往右走了否则会重复计算)然后到(n,m); 代码: #include...原创 2019-05-15 18:17:26 · 192 阅读 · 0 评论 -
求组合数C(n,m) % mod的几种方法
算法一:乘法逆元,在m,n和mod比较小的情况下适用 乘法逆元:(a/b)% mod = a * b^(mod-2),mod为素数 #include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include<queue> #include<s...原创 2019-05-15 18:20:42 · 663 阅读 · 0 评论 -
D - 11(组合数学)
Problem Statement You are given an integer sequence of lengthn+1n+1,a1,a2,...,an+1a1,a2,...,an+1, which consists of thennintegers1,...,n1,...,n. It is known that each of thennintegers1,...,n1...原创 2019-06-12 15:04:28 · 263 阅读 · 0 评论 -
C - Reconciled?(组合数学)
Problem Statement Snuke hasNNdogs andMMmonkeys. He wants them to line up in a row. As a Japanese saying goes, these dogs and monkeys are on bad terms.("ken'en no naka", literally "the relations...原创 2019-06-10 21:14:12 · 194 阅读 · 0 评论