![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数论
文章平均质量分 77
ORZZROORZZRO
川大的小可爱
展开
-
拓展GCD(转载)
感谢大佬@角落的秋天的讲解转载 2020-03-05 00:11:04 · 141 阅读 · 0 评论 -
A Research Problem(欧拉函数,DFS)
UVA10837#include <iostream>#include <algorithm>#include <cmath>#include <vector>#include <cstdio>#include <cstring>#include <queue>#include <strin...原创 2020-03-04 09:10:24 · 239 阅读 · 0 评论 -
欧拉函数 (一些性质和运用)内置杜教筛
转载链接转载 2020-03-04 08:28:34 · 205 阅读 · 0 评论 -
Yet Another Multiple Problem(同余方程+BFS)
SP12810There are tons of problems about integer multiples. Despite the fact that the topic is not original, the content is highly challenging. That’s why we call it “Yet Another Multiple Problem”.I...原创 2020-03-03 17:50:19 · 205 阅读 · 0 评论 -
中国剩余定理(孙子定理)(转载)
大佬的讲解,很清楚转载 2020-03-03 14:21:00 · 260 阅读 · 1 评论 -
Sum of Consecutive Prime Numbers(前缀和,素数筛)
UVA1210筛出素数,处理成前缀和,O(n2)O(n^2)O(n2)枚举每一种和的可能。#include <iostream>#include <algorithm>#include <cmath>#include <vector>#include <cstdio>#include <cstring>usi...原创 2020-03-03 11:48:11 · 297 阅读 · 0 评论 -
Almost Prime Numbers(素数筛)
UVA10539枚举2到high\sqrt{high}high,分别看i2,i3⋯ini^2,i^3\cdots i^ni2,i3⋯in,是否在[left,right][left,right][left,right]中,统计多少个这样的次方方在范围中即可。#include <iostream>#include <algorithm>#include <cm...原创 2020-03-03 11:30:35 · 177 阅读 · 0 评论 -
Perfect Pth Powers(唯一分解定理)
UVA10622由唯一分解定理,将nnn分解后求每个素数项对应的指数的最小公约数即可。虽然nnn在int范围内,但仍要long long,因为int的负数的绝对值比整数大1。#include <iostream>#include <algorithm>#include <cmath>#include <vector>#include ...原创 2020-03-03 10:38:42 · 1531 阅读 · 0 评论 -
Divisors(约数的数目)
UVA294题目要求指定范围内约数数目最多的数以及对应的约数数量。根据唯一分解定理,对于任意正整数2≤N2\leq N2≤N,有:N=∑i=1npiai,p为素数N=\sum\limits_{i=1}^{n}p_i^{a_i},p为素数N=i=1∑npiai,p为素数那么根据乘法原理,约数的总数目为:f(N)=∏i=1n(1+ai)f(N)=\prod\limits_{i=1}^...原创 2020-03-03 08:57:59 · 590 阅读 · 0 评论 -
Semi-prime H-numbers
UVA11105线性筛即可。#include <iostream>#include <algorithm>#include <cmath>#include <vector>using namespace std;const int MAXN = 1000001;bool IsNotHPrimer[MAXN + 1];bool...原创 2020-03-02 23:36:01 · 167 阅读 · 0 评论 -
Trees in a Wood.
UVA10214思路:对于坐标为(x,y)(x,y)(x,y)的树,需要满足gcd(x,y)=1gcd(x,y)=1gcd(x,y)=1这棵树才不会被阻挡。(同一条直线上的树从第二颗起会被遮挡)。根据对称性,设第一象限的答案为KKK,则四个象限的答案为4∗K4*K4∗K,再加上,每个坐标轴上能看见一棵树,答案为4∗K+44*K+44∗K+4。由于列比较小,考虑枚举列,对于列x,1≤y≤x1...原创 2020-03-02 22:27:15 · 162 阅读 · 0 评论 -
Send a Table(欧拉函数埃式筛)
UVA10375显然,题目要求有多少二元组(x,y)(x,y)(x,y)满足1≤x,y≤n且x,y互素1\leq x,y\leq n且x,y互素1≤x,y≤n且x,y互素。根据欧拉函数ϕ\phiϕ的定义,ϕ(n)\phi (n)ϕ(n)为小于n且与n互素的整数个数。定义f(n)=∑i=2nϕ(i)f(n)=\sum\limits_{i=2}^{n}\phi(i)f(n)=i=2∑nϕ(i...原创 2020-03-02 21:33:54 · 215 阅读 · 0 评论 -
Choose and divide
Voj#include <iostream>#include <algorithm>#include <cmath>#include <vector>#include <string.h>using namespace std;const int MAXN = 10000;//素数表vector<int>...原创 2020-03-02 20:25:20 · 111 阅读 · 0 评论 -
Minimum Sum LCM
UVA10791思路:由N=lcm(a,b)=abgcd(a,b)N=lcm(a,b)=\frac{ab}{gcd(a,b)}N=lcm(a,b)=gcd(a,b)ab可知,当且仅当gcd(a,b)=1gcd(a,b)=1gcd(a,b)=1时,a+ba+ba+b的值最小。因为若gcd(a,b)>1gcd(a,b)>1gcd(a,b)>1,则有:lcm(a,b)=abg...原创 2020-03-02 19:38:29 · 224 阅读 · 0 评论 -
Pairs of integers
HDOJ 1554You are to find all pairs of integers such that their sum is equal to the given integer number N and the second number results from the first one by striking out one of its digits. The firs...原创 2020-03-02 17:40:43 · 348 阅读 · 0 评论 -
除法表达式
Time Limit(Common/Java):1000MS/10000MS Memory Limit:65536KByteTotal Submit: 279 Accepted: 68Description给出如下除法表达式E:X1/X2/X3/…/Xk其中Xi是正整数并且Xi<=2 000 000 000(1<=i<=k,k<=1...原创 2020-03-02 09:20:06 · 643 阅读 · 0 评论