摘要: // include file#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <cctype>#include <ctime>#include <iostream>#include <sstream>#include <fstream>#include <iomanip>#include <bitset>#include <algorithm># 阅读全文
posted @ 2011-04-30 21:37 AC2012 阅读(209) 评论(0) 推荐(0) 编辑
摘要: /*算是个模拟题吧*/// include file#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <cctype>#include <ctime>#include <iostream>#include <sstream>#include <fstream>#include <iomanip>#include <bitset>#include <alg 阅读全文
posted @ 2011-04-30 21:03 AC2012 阅读(166) 评论(0) 推荐(0) 编辑
摘要: /*将一个数分成若干段,成绩最大12 = 3 * 4 * 55 = 2 * 39 = 2 * 3 * 4210 = 5 * 6 * 710 = 2 * 3 * 511 = 2 * 4 * 55 = 2 * 36 = 2 * 47 = 3 * 48 = 3 * 59 = 2 * 3 * 410 = 2 * 3 * 511 = 2 * 4 * 512 = 3 * 4 * 513 = 3 * 4 * 614 = 2 * 3 * 4 * 5*/// include file#include <cstdio>#include <cstdlib>#include <cstri 阅读全文
posted @ 2011-04-30 20:19 AC2012 阅读(157) 评论(0) 推荐(0) 编辑
摘要: /*扩展欧几里得a x1 x2b y1 y2(a*x1+b*y1) - (a*x2+b*y2) = da*x+b*y = D*/// include file#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <cctype>#include <ctime>#include <iostream>#include <sstream>#include <fstream>#include & 阅读全文
posted @ 2011-04-30 17:21 AC2012 阅读(180) 评论(0) 推荐(0) 编辑
摘要: /* m = a1*m1+r1 m = a2*m2+r2 m = a3*m3+r3 通过不断的合并方程求出最后的解,过程是这样的,以前两个方程为例 m === r1 mod a1 m === r2 mod a2 m = r1+a1*x r1+a1*x === r2 mod a2 r1+a1*x-r2 = a2*y a1*x-a2*y = r2-r1; r2 - r1 - a1*x = a2*y a1*x+a2*y = r2-r1 则可用扩展欧几里得算法求出x,y。则 m求出,不过这里只是对这两个方程而言,合并为新的方程,就有下式 m === (r1+a1*x) mod lcm(a1,a2)*/ 阅读全文
posted @ 2011-04-30 15:33 AC2012 阅读(355) 评论(0) 推荐(0) 编辑
摘要: /*x-a = 23*a';x-b = 28*b';x-c = 33*c';x === a mod 23x === b mod 28x === c mod 33求x,这是中国剩余定理,这里应用要求m1,m2,m3两两互质x mod 23 = a mod 23x mod 28 = b mod 28x mod 33 = c mod 33需要用欧拉函数了phi(n)m = 23*28*33M1 = m/m1 = 28*33M2 = m/m2 = 23*33 M3 = m/m3 = 23*28M1' = M1^(phi(m1)-1) mod m1M2' = M2 阅读全文
posted @ 2011-04-30 14:00 AC2012 阅读(140) 评论(0) 推荐(0) 编辑