摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2669这是一道纯模板的扩展GCD,直接求a*x+b*y=1就可以了,我们直接用模板,不过还要注意数的大小超过int,用__int64即可,若有不懂的地方请看http://www.cnblogs.com/yuelingzhi/archive/2011/08/13/2137582.html代码:View Code #include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>__in 阅读全文
posted @ 2011-08-16 22:39 ○o尐懶錨o 阅读(472) 评论(0) 推荐(0) 编辑
摘要: 欧拉定理之运用,#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>int mod1(int x){ int a=1,b=1,c=1,r; for(int i=0;i<=x;++i) { a=a*(i?4:2)%29; //表示2^(2*x+1) b=b*3%29; //3^(x+1) c=c*22%29; //167^(x+1) } r=(a-1)*(b-1)*(c-1)%29; //s=r/332, return 9*r%29; //s%29= 阅读全文
posted @ 2011-08-16 19:30 ○o尐懶錨o 阅读(159) 评论(0) 推荐(0) 编辑