先放知识点: 莫比乌斯反演 卢卡斯定理求组合数 乘法逆元 快速幂取模 GCD of Sequence Alice is playing a game with Bob. Alice shows N integers a 1, a 2, -, a N, and M, K. She says each integers 1 ≤ a i ≤ M. And now Alice wants to ask for each d = 1 to M, how many different sequences b…
瞬间移动 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 205 Accepted Submission(s): 109 Problem Description 有一个无限大的矩形,初始时你在左上角(即第一行第一列),每次你都可以选择一个右下方格子,并瞬移过去(如从下图中的红色格子能直接瞬移到蓝色格子),求到第n行第m列的格子有几种…
J. Ceizenpok’s formula time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Dr. Ceizenp'ok from planet i1c5l became famous across the whole Universe thanks to his recent discovery — the Ceizenp…
题集链接: https://cn.vjudge.net/contest/231988 解题之前请先了解组合数取模和Lucas定理 A : FZU-2020 输出组合数C(n, m) mod p (1 <= m <= n <= 10^9, m <= 10^4, m < p < 10^9, p是素数) 由于p较大,不可以打表,直接Lucas求解 #include<iostream> using namespace std; typedef long long…
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #include<cstring> #include<algorithm> using namespace std; typedef long long ll; int jc[100003]; int p; int ipow(int x, int b) { ll t = 1, w = x;…