摘要: //b^(-1)是 b的逆元素 (%p)//2的逆元素是15 (%29) ,因为2*15=30=1 %29//21的逆元素是18 (%29) ,因为21*18=378%29=1 %29//%运算法则 1. (a*b) %p= ( a%p) *(b%p)//%运算法则 2. (a/b) %p= ( a *b^(-1)%p) !!!! // b*b^(-1)= 1 (mod p) 若求b*b的逆元 ,则等同于 ((b*b)%p)*(b*b)^(-1)=1(mod p)#define LL long long LL ex_gcd(LL a,LL b,LL &x,LL &y){ ... 阅读全文
posted @ 2012-04-07 19:46 HaoHua_Lee 阅读(230) 评论(0) 推荐(0) 编辑
摘要: UVA 11818状态压缩+dp 判断当前点是否为必胜点,则看子节点是否存在必败点 ,若子节点全为必胜点,则当前点为必败点View Code #include<iostream>#include<cstring>#include <cstdio>#include<string>#include<queue>#include<vector>#include<map>#include <set>#include<ctime>#include<cmath>#include < 阅读全文
posted @ 2012-04-07 09:14 HaoHua_Lee 阅读(186) 评论(0) 推荐(0) 编辑