随笔分类 - 数论
摘要:算算劳资已经多久没学新算法了,又要重新开始学辣。直接扔板子,跑。。。话说FFT算法导论里讲的真不错,去看下就懂了。
阅读全文
摘要:hdu 1465 http://acm.hdu.edu.cn/showproblem.php?pid=1465 UVALive 7040 https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page
阅读全文
摘要:我们令 Ψ(x) 定义为欧拉函数。 欧拉定理描述 : 若 (a , p) = 1 , 那么 aΨ(p) Ξ 1 (mod p) . 证明: 先预热一下: Ⅰ.我们令 x1 , x2 , x3 , ……, xs 为 模p 的简化剩余系 (若果对任意的1 ≤ j ≤ s , (xj , p) = 1 并
阅读全文
摘要:求[(5+2√6)2^x+1 ] mod p 的值,其中 0 ≤ x < 232 , p 是个质数,p≤ 46337 .(这里介绍的是一种暴力的做法)(5+2√6)2^n+1 = an + bn·√6 ----©,(5-2√6)2^n+1 = an - bn·√6 ;所以(5+2√6)2^n+1 +...
阅读全文
摘要:#includeusing namespace std;int mod ;struct Matrix { int n , m ; int mat[4][4] ; int * operator [] (int x) { return...
阅读全文
摘要:最近碰到一题,问你求mod (p1*p2*p3*……*pl) ,其中n和m数据范围是1~1e18 , l≤10 , pi ≤ 1e5为不同的质数,并保证M=p1*p2*p3*……*pl≤ 1e18 。要解决这个问题首先需要Lucas定理或者C!解法。Lucas定理:我们令n=sp+q , m=tp+...
阅读全文
摘要:B. Modulo Sumtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a sequence of numbers...
阅读全文
摘要:H. Botstime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSasha and Ira are two best friends. But...
阅读全文
摘要:#include #include #include #include #include #include using namespace std; const int numlen = 205; // 位数 int max(int a, int b) { return a>b?a:b; }stru...
阅读全文
摘要:ReflectTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 288Accepted Submission(s): 174Problem Descr...
阅读全文
摘要://POJ 1811#include #include #include #include #include using namespace std;typedef __int64 lld;lld ran() { return rand() = mod) x -= mod;}lld mul_m...
阅读全文
摘要:Arcane Numbers 1Time Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uSubmitStatusPracticeHDU 4320DescriptionVance and Shackler like playi...
阅读全文
摘要:O(n) 筛选素数#includeusing namespace std;const int M = 1e6 + 10 ;int mindiv[M] ;//每个数的最小质因数int prim[M] , pnum ;//存素数bool vis[M] ;void prim () { for...
阅读全文
摘要:C. Mike and Foamtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMike is a bartender at Rico's ba...
阅读全文
摘要:C. Mike and Frogtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputMike has a frog and a flower. His...
阅读全文
摘要:魔板Time Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2170Accepted Submission(s): 455 Problem Descri...
阅读全文
摘要:Secret CodeTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 670Accepted Submission(s): 109 Problem...
阅读全文
摘要:RemainderTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3036Accepted Submission(s): 679 Problem ...
阅读全文
摘要:CodeTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 300Accepted Submission(s): 124 Problem Descri...
阅读全文