摘要: Farey Sequence 题意:给定一个数n,求在[1,n]这个范围内两两互质的数的个数。(转化为给定一个数n,比n小且与n互质的数的个数) 知识点: 欧拉函数: 普通求法:int Euler(int n) { int ans=n; for(int i=0;i1) return ans-ans/n; } 筛选法:(基于素数筛,跟着代码模拟一遍就懂)voi... 阅读全文
posted @ 2016-03-24 22:03 Shentr 阅读(1277) 评论(0) 推荐(0) 编辑
摘要: Biorhythms 题意:读入p,e,i,d 4个整数,已知(n+d)%23=p; (n+d)%28=e; (n+d)%33=i ,求n 。 (题在文末) 知识点:中国剩余定理。 /*解释*/ 题解:已知(n+d)%23=p; (n+d)%28=e; (n+d)%33=i 33×28×a模23的逆元为8, 则33×28×8=5544; ... 阅读全文
posted @ 2016-03-24 21:44 Shentr 阅读(304) 评论(0) 推荐(0) 编辑
摘要: Happy 2004 题意:s为2004^x的因子和,求s%29. (题于文末) 知识点: 素因子分解:n = p1 ^ e1 * p2 ^ e2 *..........*pn ^ en 因子和: Sum=(p1^0+p1^1….p1^e1)*(p2^0+p2^1…p2^e2)……(pn^0+…pn^en) =; 积性函数:s(xy)... 阅读全文
posted @ 2016-03-24 21:06 Shentr 阅读(339) 评论(0) 推荐(0) 编辑
http://www.cnblogs.com/shentr/