摘要: 输入n(using namespace std;typedef long long LL;LL a[15];LL gcd(LL a,LL b) //求a和b的最大公约数{ if(b) return gcd(b,a%b); return a;}LL lcm(LL a,LL b) //求a和b的最小公倍... 阅读全文
posted @ 2015-08-03 15:57 茶飘香~ 阅读(417) 评论(0) 推荐(0) 编辑
摘要: typedef long long LL;LL quick(LL a,LL b,LL m) //a^b%m 快速取模 使得复杂度从0(b){ // 降低为0(log2(b)) LL ans=1; while(b) { if(b&1) ans=ans*a%m; b>>=1; a=a*a%m; } re... 阅读全文
posted @ 2015-08-03 10:48 茶飘香~ 阅读(1015) 评论(0) 推荐(0) 编辑