摘要: Theorem For any two integers x and k there exists two more integers p and q such that: It’s a fairly easy task to prove this theorem, so we’d n... 阅读全文
posted @ 2014-11-17 21:12 星斗万千 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 欧几里德算法又称辗转相除法,用于计算两个整数a,b的最大公约数。 基本算法:设a=qb+r,其中a,b,q,r都是整数,则gcd(a,b)=gcd(b,r),即gcd(a,b)=gcd(b,a%b)。 第一种证明: a可以表示成a = kb + r,则r = a mod b 假设... 阅读全文
posted @ 2014-11-17 19:20 星斗万千 阅读(162) 评论(0) 推荐(0) 编辑
摘要: Description 要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。 Input 数据的第一行是一个T,表示有T组数据。 每组数据有两个数n(0 using namespace std;... 阅读全文
posted @ 2014-11-17 18:01 星斗万千 阅读(131) 评论(0) 推荐(0) 编辑