摘要:http://acm.nyist.net/JudgeOnline/problem.php?pid=69View Code 1 #include<stdio.h> 2 #include<math.h> 3 int main() 4 { 5 int t; 6 int n; 7 double sum; 8 scanf("%d",&t); 9 while(t--)10 {11 sum=0;12 scanf("%d",&n);13 for(int i=n;i>=1;i--)14 sum+=l...
阅读全文
摘要:View Code 1 #include<stdio.h> 2 int gcd(int x,int y) 3 { 4 int r; 5 while(y!=0) 6 { 7 r=x%y; 8 x=y; 9 y=r;10 }11 return x;12 }13 int main()14 {15 int a,b;16 while(~scanf("%d%d",&a,&b))17 {18 printf("%d\n",gcd(a,b));19 }20 }
阅读全文
摘要:http://hi.baidu.com/%E9%A3%8E%E9%9B%B7%E8%BF%85%E7%83%88/blog/item/6266d9b34f18936d8ad4b253.html
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4349Xiao Ming's HopeTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 279Accepted Submission(s): 198Problem DescriptionXiao Ming likes counting numbers very much, especially he is fond of counting odd num
阅读全文
摘要:判定准则 (m≤ )的奇偶性取决于m和 —m的二进制表达式中是否存在位于同一数位上的两个数码都是1,如果存在,是偶数,否则 就是奇数组合数的奇偶 奇偶定义:对组合数C(n,k) (n>=k):将n,k分别化为二进制,若某二进制位对应的n为0,而k为1 ,则C(n,k)为偶数;否则为奇数。 下面是判定方法: 结论: 对于C(n,k),若n&k == k 则c(n,k)为奇数,否则为偶数。 证明: 对于C(n,k),若n&k == k 则c(n,k)为奇数,否则为偶数。
阅读全文