Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
定理In Reply To:1句话AC Posted by:plokzfadai at 2010-02-08 23:19:23 c(n,k)(k<=n)的奇偶性取决于(n-k)与k的二进制表达式是否存在同一位上的两个数码均为1,若存在,则为偶数,反之为奇数 #include<stdio.h> int n,k; int main(){ while(scanf("%d%d", &n, &k)!=EOF){ printf("%d\n", k&(n-k)?0:1); } return 0; } 参考资料:【数学通讯(2006年第一期)】“二项式系数奇偶性的判定准则” Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator