在kuangbin带你飞专题看到的,水了一发,但是wa了一次,T了一次,竟然连素数打表都快不会写了。
而且连求素数时候只需到根号n就可以都忘了,假设有因子m大于√n,那么n/m一定小于√n,所以它在√n前面已经被选出来了。
代码:
#include
#include
#include
#include
#include
#include
#include
#include
#include
...
分类:
其他好文 时间:
2015-08-26 18:01:02
阅读次数:
172
Problem DescriptionGiven a number n, please count how many tuple(p1, p2, p3) satisfied that p1 2 #include 3 using namespace std; 4 const int N=10005; ...
分类:
其他好文 时间:
2015-08-25 20:53:06
阅读次数:
90
题目链接:Distinct Primes如果一个数。至少有三个因子是素数、。那么这个数就是primenum.30和42是前两个primenum.问你第n个这种数是谁。(1#include#include#includeusing namespace std;typedef long long ll;...
分类:
其他好文 时间:
2015-08-21 22:49:36
阅读次数:
135
SPOJ PGCD - Primes in GCD Table (好题! 莫比乌斯反演+分块求和优化)...
分类:
其他好文 时间:
2015-08-20 13:12:34
阅读次数:
172
AMR11E - Distinct Primes
no tags
Arithmancy is Draco Malfoy's favorite subject, but what spoils it for him is that Hermione Granger is in his class, and she is better than him at it. ...
分类:
其他好文 时间:
2015-08-20 10:33:00
阅读次数:
176
Difference Between PrimesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2998Accepted Submission(s...
分类:
其他好文 时间:
2015-08-19 23:32:00
阅读次数:
130
Distinct Primes
Arithmancy is Draco Malfoy's favorite subject, but what spoils it for him is that Hermione Granger is in his class, and she is better than him at it. Prime numbers are of mystical im...
分类:
其他好文 时间:
2015-08-19 14:52:58
阅读次数:
109
一个数只有三个约数的特征:约数都是成对出现的,有奇数个约数说明有一对约数是相同的;
也就是说这个数是平方数,只有三个约数说明这个数还得是素数(质数)的平方;
平方小于5000的素数共有19个,因此1到5000中只有三个约数的数有19个。
相关例题: B. T-primes代码:#include
#include
#include
using na...
分类:
其他好文 时间:
2015-08-18 12:06:03
阅读次数:
169
Distinct primes factors
Problem 47
The first two consecutive numbers to have two distinct prime factors are:14 = 2 × 7
15 = 3 × 5The first three consecutive numbers to have three distinct prime fact...
分类:
其他好文 时间:
2015-08-15 21:36:32
阅读次数:
233
题意:给一个p和q然后求π(n)?≤?p/q*rub(n),的最大的n值,其中π(n)?表示从1到n之间的素数的个数,
rub(n)表示从1到n之间的回文数的个数(回文数不能有前导0,且从左到右和从右到左一样)
分析:其实这题没有题目没有确定n的范围让人不敢直接暴搜打表,但是你只要手动写个函数y=π(n)?/rub(n)
手动模拟暴力一下就可以发现其实这个函数大概是先下降后上升的,由...
分类:
其他好文 时间:
2015-08-15 16:36:09
阅读次数:
182