Mysterious For-HDU 4373 题目描述 MatRush is an ACMer from ZJUT, and he always love to create some special programs. Here we will talk about one of his recent inventions. This special program was called "Mysterious For", it was written in C++ languag…
公式 $$C_n^m\%p=C_{n/p}^{m/p}*C_{n\%p}^{m\%p}\%p~~(p为素数)$$ 代码如下 typedef long long ll; ll mod_pow(ll x, ll n, ll mod) { ll res = 1; while (n > 0) { if (n & 1) res = res * x % mod; x = x * x % mod; n >>= 1; } return res; } ll comb(ll n, ll m, ll…
How Many Sets II Time Limit: 2 Seconds Memory Limit: 65536 KB Given a set S = {1, 2, ..., n}, number m and p, your job is to count how many set T satisfies the following condition: T is a subset of S |T| = m T does not contain continuous numbers…
D1T1 玩具谜题 xjb模拟即可 #include<bits/stdc++.h> #define N (100000+5) using namespace std; inline int read() { int cnt = 0, f = 1; char c; c = getchar(); while (!isdigit(c)) { if (c == '-') f = -f; c = getchar(); } while (isdigit(c)) { cnt = (cnt <<…