题意:给出整数T,P,求c(T,P) mod P. 解法:用卢卡斯定理. 卢卡斯定理:解决c(n,m) mod p问题.Lucas(n,m,p)=c(n%p,m%p)*Lucas(n/p,m/p,p). 本题m=p,所以Lucas(n,p,p)化简得(n/p)%p. 卢卡斯定理的证明在网上找了好多都看不懂···以后有机会再学吧. 代码: #include<stdio.h> #include<iostream> #include<algorithm> #include&l…
So Easy! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5905 Accepted Submission(s): 1966 Problem Description A sequence Sn is defined as:Where a, b, n, m are positive integers.┌x┐is the cei…
C - Pashmak and Buses Codeforces Round #261 (Div. 2) C. Pashmak and Buses time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Recently Pashmak has been employed in a transportation company. The…