摘要: 暴力法: 1 int i;2 for (i=1;;i++) { if (((long long int)(n)*i-an)%M==0) break; }欧拉函数1 long long inv( long long n )2 {3 return pow( n, M - 2 )%M;4 }扩展欧几里得 1 //扩展欧几里德 2 void exp_gcd( LL a ,LL b,LL &x,LL &y) { 3 if( b == 0 ) { 4 x = 1; 5 y = 0; 6 } 7 else { 8 ... 阅读全文
posted @ 2013-08-02 20:09 淡墨æ末央 阅读(368) 评论(0) 推荐(0) 编辑
摘要: 链接:http://poj.org/problem?id=1286http://poj.org/problem?id=2409 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 typedef long long LL; 8 LL P_M( LL a, LL b ) 9 {10 LL res=1, t=a;11 while (b){12 if(b&1)res*=t;13 t*=t;14 b>>=1;15 ... 阅读全文
posted @ 2013-08-02 19:56 淡墨æ末央 阅读(252) 评论(0) 推荐(0) 编辑