随笔分类 -  数论 --- 整除性问题

hdu 1299 Diophantus of Alexandria
摘要:1/x + 1/y = 1/n 1n 那么设 x=n+m 那么 1/y= 1/n - 1/(n+m)// 1/y = m/(n*n+n*m) 所以满足 n*n|m 的m都是可以的 // 问题转化成求n*n 的约数个数 因数分解 然后用求约数个数公式// 最后答案记得 除 2 因为重复算了#include #include #include #include #include #include #include using namespace std;#define maxm 100010// #define maxn 47010#define LL __int64int prim[470... 阅读全文

posted @ 2013-07-25 17:19 江财小子 阅读(207) 评论(0) 推荐(0)

poj 2773 Happy 2006
摘要:// 题意 :给你两个数 m(10^6),k(10^8) 求第k个和m互质的数是什么这题主要需要知道这样的结论gcd(x,n)=1 gcd(x+n,n)=1证明 假设 gcd(x,n)=1 gcd(x+n,n)!=1 令 a=n+x b=n 设 gcd(a,b)=k>1 那么有 a=Ak b=Bk x+Bk=Ak => x=(A-B)k k是n的因子 那么 x=(A-B)k 显然不成立 因为x不可能含有因子k(因为x,n互质); 所以假设不成立 那么这题剩下的就算求 比m小 与m互质的数就可以了#include #include #include #i... 阅读全文

posted @ 2013-07-25 11:01 江财小子 阅读(196) 评论(0) 推荐(0)

hdu 4282 A very hard mathematic problem
摘要:A very hard mathematic problemTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2489Accepted Submission(s): 728Problem Description Haoren is very good at solving mathematic problems. Today he is working a problem like this: Find three positive int... 阅读全文

posted @ 2012-10-22 16:14 江财小子 阅读(333) 评论(0) 推荐(0)

xmu 1254.异或求和
摘要:1254.异或求和 Time Limit: 1000 MS Memory Limit: 65536 K Total Submissions: 52 (19 users) Accepted: 13 (7 users) Description给你2个区间[A,B]和[C,D],现在只要求你求出区间[A,B]和[C,D]内任意2个整数异或后的和,因为答案可能会很大,你只需将结果%mod即可。For(i:A→B) For(j:C→D) Sum += (i^j);Input输入第一行为T(T=2^(k-1) 的 x 第k位就是1这样只要求出 x某个范围 ,其它就是它的等价类了这... 阅读全文

posted @ 2012-10-22 15:35 江财小子 阅读(1877) 评论(0) 推荐(0)