随笔分类 - NumberTheory(数论)
摘要:1 const ll mod=1e9+7; 2 ll qpow(ll a,ll b) 3 { 4 ll c=1; 5 while(b) 6 { 7 if(b&1)c=ll(c*a)%mod; 8 a=ll(a*a)%mod; 9 b>>=1; 10 } 11 return c; 12 } 13 ll C(ll y,ll x) 14 { 15 if(y<0||x<0||y<x)return 0; 1
阅读全文
摘要:It’s a Mod, Mod, Mod, Mod World 题目描述 You are given multiple problems with three integers p, q, and n. Find . That is, the first n multiples of p, modu
阅读全文
摘要:C: Prime-Factor Prime 题目描述 A positive integer is called a "prime-factor prime" when the number of its prime factors is prime. For example, 12 is a pri
阅读全文
摘要:G: Give Candies 题目描述 There are N children in kindergarten. Miss Li bought them N candies。To make the process more interesting, Miss Li comes up with t
阅读全文
摘要:十进制快速幂 例:求a^b%mod,(a<=10,b<=1e100000,mod=1e9+7) 说明 这时候 long long是存不下b的,但是可以用字符数组存; 举个简单例子,求 2^2345; 可以依次求2^2 -> (2^2)^10=2^20 -> (2^20)^3=2^23 -> (2^2
阅读全文

浙公网安备 33010602011771号