码迷,mamicode.com
首页 >  
搜索关键字:prime    ( 2475个结果
Ugly numbers
Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include2, 3, 5. For examp...
分类:其他好文   时间:2015-09-15 23:06:33    阅读次数:122
Count Primes 解答
QuestionCount the number of prime numbers less than a non-negative number,n.Solution 1Naive way, to check each number one by one. If a number i is pri...
分类:其他好文   时间:2015-09-14 07:10:35    阅读次数:207
poj1284 Primitive Roots
考虑互质的两个数a 2 #include 3 using namespace std; 4 int n; 5 int prime[100], k; 6 7 void solve(){ 8 int m = n - 1; 9 k = 0;10 if(m % 2 == 0){...
分类:其他好文   时间:2015-09-13 21:27:09    阅读次数:133
埃氏筛法的一般写法
问题:求[L, R]之间的素数表解法:先用埃氏筛法求出[1...sqrt(R)]上的素数表再在[L, R]上用埃氏筛法求素数const int N(1e5);bool isprime[N];int prime[N];void init(){ memset(isprime, -1, sizeof...
分类:其他好文   时间:2015-09-13 18:32:09    阅读次数:125
算法之路1_Prime
Prime算法的3中模板Prime算法的基本思想1.清空生成树,任取一个顶点加入生成树2.在那些一个端点在生成树里,另一个端点不在生成树里的边中,选取一条权最小的边,将它和另一个端点加进生成树3.重复步骤2,直到所有的顶点都进入了生成树为止,此时的生成树就是最小生成树1. Prime不带参数void...
分类:编程语言   时间:2015-09-11 19:09:02    阅读次数:162
A - Prime Ring Problem(素数环,深搜,打表)
DescriptionA ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in ...
分类:其他好文   时间:2015-09-10 17:23:49    阅读次数:141
hdu1569 莫比乌斯反演
hdu 1695莫比乌斯反演给出a,b,c,d,k, 求满足a #include #include #include #include using namespace std;const int maxn=1000005;bool check[maxn];int mu[maxn];int prime...
分类:其他好文   时间:2015-09-10 12:27:33    阅读次数:249
263 Ugly Number
Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include2, 3, 5. For examp...
分类:其他好文   时间:2015-09-08 09:34:55    阅读次数:108
hdu 5108 Alexandra and Prime Numbers (水题,暴力)
Problem DescriptionAlexandra has a little brother. He is new to programming. One day he is solving the following problem: Given an positive integer N,...
分类:其他好文   时间:2015-09-07 19:24:25    阅读次数:130
LeetCode:Count Primes - 统计质数数量
1、题目名称 Count Primes(统计质数数量) 2、题目地址 https://leetcode.com/problems/count-primes/ 3、题目内容 英文:Count the number of prime numbers less than a non-negative number, n. 中文:统计正...
分类:其他好文   时间:2015-09-07 00:43:16    阅读次数:202
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!