
数论
文章平均质量分 88
overload1997
努力 努力 再努力
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
BZOJ2440: [中山市选2011]完全平方数dizh
链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2440中文题意很明确,要我们输入一个数k,求出第k个不是完全平方数的数。解法就是求出1-x(一开始要设置一个大的上限 然后开始二分缩小区间直到找到答案)内的非完全平方数的个数,二分找到一个l=r时刚好非完全平方数的结果==k需要的知识:二分法+容斥+莫比乌斯反演AC代码如下:原创 2016-05-07 21:13:21 · 655 阅读 · 0 评论 -
51nod1228 序列求和 (伯努利数)
1228 序列求和题目来源: HackerRank基准时间限制:3 秒 空间限制:131072 KB 分值: 160 难度:6级算法题 收藏 关注T(n) = n^k,S(n) = T(1) + T(2) + ...... T(n)。给出n和k,求S(n)。例如k = 2,n = 5,S(n) = 1^2 + 2^2 +原创 2017-10-05 15:48:47 · 498 阅读 · 0 评论 -
Codeforces Beta Round #86 (Div. 2 Only) E Double Happiness 素数筛法,费马平方和定理
题目链接E. Double Happinesstime limit per test3 secondsmemory limit per test128 megabytesinputstandard inputoutputstandard outputOn the math lesson原创 2017-10-08 19:40:13 · 565 阅读 · 0 评论 -
hdu4777 Rabbit Kingdom (离线处理、互斥)
Online JudgeOnline ExerciseOnline TeachingOnline ContestsExercise AuthorF.A.QHand In HandOnline AcmersForum | DiscussStatistical ChartsProblem ArchiveRealtime Judge Statu原创 2017-09-28 08:49:23 · 500 阅读 · 0 评论 -
大素数判断和素因子分解(miller-rabin,Pollard_rho算法)
转载自:http://www.cnblogs.com/kuangbin/archive/2012/08/19/2646396.html传说中的随机算法。效率极高。可以对一个2^63的素数进行判断。可以分解比较大的数的因子。素数判定的时间是O(log(n))Pollard_rho算法的时间复杂度是O(n^1/4)--->用于求一个大数的其中一个质因子#includ转载 2017-08-04 22:36:17 · 449 阅读 · 0 评论 -
O(n)欧拉函数+素数筛选
用最小的素因子筛掉每个数 int prime[N],phi[N],cnt;// prime:记录质数,phi记录欧拉函数 int Min_factor[N];// i的最小素因子 bool vis[N]; void Init() { cnt=0; phi[1]=1; int x; for(int i=2;i<N;i++)转载 2016-10-01 17:42:32 · 378 阅读 · 0 评论 -
poj 1845 Sumdiv
SumdivTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 19529 Accepted: 4916DescriptionConsider two natural numbers A and B. Let S be the sum of all natur原创 2016-09-08 20:17:48 · 260 阅读 · 0 评论 -
积性函数
点击打开链接转载 2016-09-07 17:27:22 · 486 阅读 · 0 评论 -
poj3696 The Luckiest number
The Luckiest numberTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5120 Accepted: 1370DescriptionChinese people think of '8' as the lucky digit. Bob also likes digit '8'. Moreover, Bob has h原创 2016-09-07 16:42:29 · 309 阅读 · 0 评论 -
poj2478 Farey Sequence
//pku2478//思路,dp,递推方式为dp[i] =dp[i-1]+phi[i];#include #include #include #include using namespace std;typedef long long LL;const int maxn=1e6+5;int phi[maxn+10];LL dp[maxn+10];int main(){ i原创 2016-09-07 16:40:48 · 259 阅读 · 0 评论 -
2016多校联赛4E (hdu5768) Lucky7
Lucky7Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 318 Accepted Submission(s): 127Problem DescriptionWhen ?? was born, sev原创 2016-07-28 22:22:12 · 964 阅读 · 8 评论 -
莫比乌斯反演模板
void getmu(){ int tot=0; mu[1]=1; for(int i=2;imaxn;i++) { if(!vis[i]) { prime[++tot]=i; mu[i]=-1; } for(int j=1;prime[j]*imaxn;j++) { vis[prime[j]*i]=1; if(i%prime[j]==0)原创 2016-05-07 21:06:48 · 562 阅读 · 0 评论 -
UVA11426 FZU1969 51NOD1188 线性欧拉筛法+筛法
题目大意:计算:G=∑i<Ni=1∑j<=Nj=i+1GCD(i,j)G=\sum_{i=1}^{i<N}\sum_{j=i+1}^{j<=N}{GCD(i,j)}难度系数(往下递增):UVA11426FZU196951NOD1188题目思路一:G=∑ng=1g(∑phi(⌊gd⌋−1) G=\sum_{g=1}^{n}{g(\sum{phi(\lfloor{\frac{g}{d}}\rfloor-原创 2017-11-02 02:00:28 · 382 阅读 · 0 评论