CY_

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2014年4月11日

摘要: Problem Description要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973)= 1)。Input数据的第一行是一个T,表示有T组数据。每组数据有两个数n(0 A = B*x;n = A % 9973 = A - A / 9973 * 9973 := B*x - A/9973*9973= n可以 令 y = A / 9973; 则 B * x + y * 9973 = n; 因为 gcd(9973,B) = 1,所以不能用exgcd(B,9973,x,y);B * x1 + 9973 * y1 = 1; -.. 阅读全文
posted @ 2014-04-11 15:41 CY_ 阅读(126) 评论(0) 推荐(0) 编辑

摘要: Problem Description我知道部分同学最近在看中国剩余定理,就这个定理本身,还是比较简单的:假设m1,m2,…,mk两两互素,则下面同余方程组:x≡a1(mod m1)x≡a2(mod m2)…x≡ak(mod mk)在0#includeusing namespace std;__int64 gcd(__int64 a,__int64 b)//求最大公约数{ __int64 temp; if(a>n>>a&&n&&a) { //memset(a,0,sizeof(a)); ans = 1; cin>>x; ... 阅读全文
posted @ 2014-04-11 13:23 CY_ 阅读(154) 评论(0) 推荐(0) 编辑