
数论
文章平均质量分 76
Astronomical
沉思了太久,那片刻,恍惚成了哲学家。
拼多多内推,需要的小伙伴欢迎来看看~
https://github.com/shentr/recruit/blob/main/README.md
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
数论总结(content)
1.埃拉托色尼(ERATOSTHENES)筛法 2.素因子分解 X = p1^a1 * p2^a2 * p3^a3*…*pn^a 1. X的约数的个数为(a1+1)*(a2+1)*…*(an+1) 2. X的约数的和为 (p1^0+p1^1^…+p1^a1)*…* (pn^0+pn^1^…+pn^an) 3..阶乘的素因子分解 f原创 2015-08-30 13:47:50 · 838 阅读 · 0 评论 -
HDU5920 Ugly Problem(高精度)
题意:将数字n转化成若干个回文数字之和。 题解:因为带着完美主义的追求,把这题做傻了。。。 思路是对的,只是多考虑了些不必要的细节,导致本来简单的问题复杂化了,又被指针坑了一把。 所幸AC了,就贴出来当作对指针的回顾吧。 #include"bits/stdc++.h" using namespace std; const int N=1e3+100; char *原创 2016-10-06 20:53:47 · 1090 阅读 · 0 评论 -
Pairs Forming LCM(素因子分解+lcm)
Pairs Forming LCM Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Submit Status Description Find the result of the following code: long long pairsFormLCM( int原创 2016-03-17 15:21:48 · 1168 阅读 · 1 评论 -
poj2478 Farey Sequence (欧拉函数)
Farey Sequence 题意:给定一个数n,求在[1,n]这个范围内两两互质的数的个数。(转化为给定一个数n,比n小且与n互质的数的个数) 知识点: 欧拉函数: 普通求法: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1原创 2016-03-28 12:28:28 · 956 阅读 · 0 评论 -
poj1006 / hdu1370 Biorhythms (中国剩余定理)
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, 则原创 2016-03-28 12:27:03 · 960 阅读 · 0 评论 -
hdu2588 GCD (欧拉函数)
GCD 题意:输入N,M(2=M的X的个数。 (文末有题) 知识点: 欧拉函数。http://www.cnblogs.com/shentr/p/5317442.html 题解一: 当M==1时,显然答案为N。 当M!=1。 X是N的因子的倍数是 gcd(X,N)>1 && Xso 先把N素因子分解, N= (e原创 2016-03-28 12:22:45 · 2291 阅读 · 0 评论 -
hdu 4704 Sum (整数和分解+快速幂+费马小定理降幂)
题意: 给n(1),求(s1+s2+s3+...+sn)mod(1e9+7)。其中si表示n由i个数相加而成的种数,如n=4,则s1=1,s2=3。 (全题文末) 知识点: 整数n有种和分解方法。 费马小定理:p是质数,若p不能整除a,则 a^(p-1) ≡1(mod p)。可利用费马小定理降素数幂。原创 2016-03-28 12:20:37 · 3202 阅读 · 0 评论 -
hdu5317 RGCDQ (质因子种数+预处理)
RGCDQ 题意:F(x)表示x的质因子的种数。给区间[L,R],求max(GCD(F(i),F(j)) (L≤i 题解:可以用素数筛求质因子种数(这不用多说,看下代码init()中内容就能理解)。然而R的范围太大,会TLE。因此只能用空间换时间了。 可以用一个二维数组num[i][j] 保存x 2*3*5*7*11*13*17 > 10 ^ 6,即在1~1e6的原创 2016-03-28 12:19:01 · 1141 阅读 · 0 评论 -
hdu1452 Happy 2004(规律+因子和+积性函数)
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)原创 2016-03-28 12:14:43 · 890 阅读 · 0 评论 -
数论 随记
1. 秦九昭算法: || \/ 求n次多项式f(x)的值就转化为求n个一次多项式的值。 HDU 1111 处理 :减ai后,除B,直到0为止 复数的模 |Z|=|a+bi|=sqrt(a*a+b*b) , 除法(a+bi)/(c+di)=(ac+bd)/(c*c+原创 2016-03-08 21:27:30 · 1447 阅读 · 0 评论 -
hdu1695 GCD(莫比乌斯反演)
题意:求(1,b)区间和(1,d)区间里面gcd(x, y) = k的数的对数(1 知识点: 莫比乌斯反演/*12*/ 线性筛求莫比乌斯反演函数: void Init() { memset(vis,0,sizeof(vis)); mu[1] = 1; cnt = 0; for(int i=2; i<N; i++)原创 2016-04-03 13:50:42 · 1274 阅读 · 0 评论 -
Sigma Function (因子和)
Sigma Function Description Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ). This function actually denotes the sum of all divisors of a nu原创 2016-03-16 21:22:48 · 2547 阅读 · 1 评论 -
hdu1299 Diophantus of Alexandria---素因子分解
Diophantus of AlexandriaTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1849 Accepted Submission(s): 698Problem Description Diophantus of A原创 2015-06-26 13:35:49 · 841 阅读 · 0 评论 -
hdu1121 Complete the Sequence
HDU1121 题意:给你一个整数序列包含S个整数,让你找到这个序列满足的多项式 P(n) = aD.n^D+aD-1.n^D-1+...+a1.n+a0,当这个多项式的阶最小时,输出接下来的满足这个多项式C个整数 差分。计算xi相邻两项差 得序列x2i,计算x2i相邻两项差 得序列x3i,重复以上过程,直到xni的各项值相等。再回算。 #include #inc原创 2016-01-27 17:55:14 · 1060 阅读 · 0 评论 -
hdu1111 Secret Code
That means the sequence of numbers an, an-1, ..., a1, a0 was encoded as the number X = a0 + a1*B + a2*B^2 + ...+ an*B^n. Your goal is to decrypt the secret code, i.e. to express a given number X i原创 2016-01-26 11:12:51 · 1191 阅读 · 0 评论 -
hdu1005 循环节||矩阵快速幂取模
Number SequenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 136686 Accepted Submission(s): 33136Problem Description A number sequence is原创 2015-11-26 21:15:11 · 1145 阅读 · 0 评论 -
SGU 154-Factorial
154. Factorial time limit per test: 0.25 sec. memory limit per test: 4096 KB input: standard input output: standard output You task is to find minimal natural number N, so that N!原创 2015-08-30 14:36:35 · 820 阅读 · 0 评论 -
Help Hanzo (素数筛+区间枚举)
Help Hanzo Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Description Amakusa, the evil spiritual leader has captured the beautiful princess Nakururu. The reason原创 2016-03-20 17:51:14 · 1492 阅读 · 5 评论