HDU 4349 Xiao Ming's Hope 找规律】的更多相关文章

原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=4349 Xiao Ming's Hope Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1723    Accepted Submission(s): 1144 Problem Description Xiao Ming likes coun…
Xiao Ming's Hope Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description Xiao Ming likes counting numbers very much, especially he is fond of counting odd numbers. Maybe he thinks it is the best way to…
Xiao Ming's Hope Time Limit:1000MS     Memory Limit:32768KB  Description Xiao Ming likes counting numbers very much, especially he is fond of counting odd numbers. Maybe he thinks it is the best way to show he is alone without a girl friend. The day…
Xiao Ming's Hope Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1786    Accepted Submission(s): 1182 Problem Description Xiao Ming likes counting numbers very much, especially he is fond of cou…
非常无语的一个题. 反正我后来看题解全然不是一个道上的. 要用什么组合数学的lucas定理. 表示自己就推了前面几个数然后找找规律. C(n, m) 就是 组合n取m: (m!(n-m!)/n!) 假设n==11 : C(11,0):C(11,1):C(11,2):C(11,3):C(11,4):C(11,5): 分别为 (1/1); (1 / 11) ; (11*10 / 2*1)  ;   (11*10*9 / 3*2*1); (11*10*9*8 / 4*3*2*1) ;  (11*10*…
题意:给你n,问在C(n,1),C(n,2)...C(n,n)中有多少个奇数. 比赛的时候打表看出规律,这里给一个数学上的说明. Lucas定理:A,B非负整数,p是质数,A,B化为p进制分别为a[n]a[n-1]...a[0],b[n]b[n-1]...b[0]. 那么组合数C(A,B)与C(a[n],b[n])*...*C(a[0],b[0])模p同余. 证明就不说了,我也不会,给个链接  Lucas定理证明 那再来看这道题就简单了,p=2,C(0,1)=0,C(1,0) = C(1,1)…
有这样一个性质:C(n,m)%p=C(p1,q1)*C(p2,q2).......%p,其中pkpk-1...p1,qkqk-1...q1分别是n,m在p进制下的组成. 就完了. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ; int main() { while (scanf("%d",&am…
题目链接 给一个n, 求C(n, 0), C(n, 1), ..........C(n, n)里面有多少个是奇数. 我们考虑lucas定理, C(n, m) %2= C(n%2, m%2)*C(n/2, m/2)%2,   C(n/2, m/2) = C(n/2%2, m/2%2)*C(n/2/2, m/2/2), 这样一直递归下去,直到m为0. 我们知道如果一个数是奇数, 那么它的所有因子都是奇数, 对应于上面的式子, n%2是偶数的时候, m%2也必须是偶数才可以, 而n%2是奇数的时候,…
这种题面真是够了......@小明 题意:the number of odd numbers of C(n,0),C(n,1),C(n,2)...C(n,n). 奇数...就是mod 2=1啊 用Lucas定理,2的幂,就是二进制啊 ${1\choose 1}={1\choose 0}={0\choose 0}=1 \quad {0\choose 1}=0$ 只要二进制有1位n是0而i是1,${n\choose i}$就不是奇数啦 对于n二进制的每一个1,i都有两种选择,答案就是$2^{bitC…
Birthday Toy Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 644    Accepted Submission(s): 326 Problem Description AekdyCoin loves toys. It is AekdyCoin’s Birthday today and he gets a special “…