#include #include #include #include #include using namespace std; #define maxn 50000 int vis[maxn], isprime[5200], num[100005], k; void prime()//只需要把[... ...
分类:
其他好文 时间:
2018-09-30 18:13:04
阅读次数:
174
class Solution { public: bool IsPrime(int n) { if (n == 1) { return false; } if (n == 2 || n == 3) { return true; } ... ...
分类:
其他好文 时间:
2018-09-29 12:00:47
阅读次数:
137
"原题:372. Super Pow" Your task is to calculate ab mod 1337 where a is a positive integer and b is an extremely large positive integer given in the form ...
分类:
其他好文 时间:
2018-09-28 12:56:56
阅读次数:
154
204. Count Primes 204. Count Primes 204. Count Primes 204. Count Primes Count the number of prime numbers less than a non-negative number, n. Example: ...
分类:
其他好文 时间:
2018-09-26 00:12:10
阅读次数:
158
向容器中添加元素和从容器中删除元素的操作可能会使容器元素的指针,引用或迭代器失效。 在容器添加元素后 如果容器是vector或string,且存储空间被重新分配,则指向容器的迭代器,指针和引用 都会失效。如果存储空间未被重新分配,指向插入位置之前的元素的迭代器,指针和引用仍有效,但指向插入位置之后元 ...
分类:
其他好文 时间:
2018-09-25 01:31:58
阅读次数:
145
"传送门" 看到$n$只有16,可以把这些质数分成两半,然后预处理出这些数相乘得出的小于$10^{18}$的所有数,排个序,然后二分最终答案,再用两个指针从前往后和从后往前扫,进行$two pointers$统计答案是第几个,然后再搞搞救星了 cpp // luogu judger enable o ...
分类:
其他好文 时间:
2018-09-22 21:16:43
阅读次数:
178
Max Sum Problem Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,- ...
分类:
其他好文 时间:
2018-09-22 18:26:57
阅读次数:
124
http://acm.hdu.edu.cn/showproblem.php?pid=2139 Problem Description You just need to calculate the sum of the formula: 1^2+3^2+5^2+……+ n ^2. Input In e ...
分类:
其他好文 时间:
2018-09-21 15:11:32
阅读次数:
174
(偷偷吐槽网上有些题解没说清楚为什么if(n s) swap(n,s) 题意 给定T组数据,以及n、s $(1 \leq T \leq 100) (1 \leq n \leq 1e9) (0 \leq s \leq 1e9)$ 问是否能得到一个s+1 s+n共n个数的排列,使得每个位置i上的值$v_ ...
分类:
其他好文 时间:
2018-09-19 14:53:58
阅读次数:
153
https://pintia.cn/problem-sets/994805342720868352/problems/994805495863296000 A reversible prime in any number system is a prime whose "reverse" in th ...
分类:
其他好文 时间:
2018-09-18 19:56:00
阅读次数:
154