随笔分类 -  数论--gcd,lcm,扩展gcd

POJ 1845 Sumdiv
摘要:SumdivTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 10515Accepted: 2477DescriptionConsider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of S by 9901).InputThe only line contains the two natural numbers A an 阅读全文

posted @ 2012-10-22 23:52 江财小子 阅读(198) 评论(0) 推荐(0)

FZU 1969 GCD Extreme UESTC 1723 吴神的大脑
摘要:Accept: 77Submit: 136Time Limit: 1000 mSecMemory Limit : 32768 KB Problem DescriptionGiven the value of N, you will have to find the value of G. The meaning of G is given in the following code G=0; for(i=1;i<N;i++) for(j=i+1;j<=N;j++) G+=gcd(i,j); /*Here gcd() is a function that finds the... 阅读全文

posted @ 2012-09-22 09:51 江财小子 阅读(702) 评论(0) 推荐(0)

Hdu 1576 A/B
摘要:A/BTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 592Accepted Submission(s): 475Problem Description要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。Input数据的第一行是一个T,表示有T组数据。每组数据有两个数n(0 <= n < 9973)和B(1 <= B <= 10^9)。O 阅读全文

posted @ 2012-07-21 15:10 江财小子 阅读(215) 评论(0) 推荐(0)

POJ 1061 青蛙的约会
摘要:Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐观的青蛙,你被要求写一个程序来判断这两只青蛙是否能够碰面,会在什么时候碰面。 我们把这两只青蛙分别叫做青蛙A和青蛙B,并且规定纬度线上东经0度处为原点,由东往西为正方向,单位长度1米,这样 阅读全文

posted @ 2012-04-13 11:27 江财小子 阅读(198) 评论(0) 推荐(0)