码迷,mamicode.com
首页 >  
搜索关键字:primes    ( 339个结果
欧拉工程第58题:Spiral primes
题目链接 Java程序 package projecteuler51to60; import java.math.BigInteger; import java.util.Iterator; import java.util.Set; import java.util.TreeSet; class ...
分类:其他好文   时间:2015-08-09 22:21:26    阅读次数:224
pat1015. Reversible Primes (20)
1015. Reversible Primes (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueAreversible primein any number system is a prime whose "reverse"...
分类:其他好文   时间:2015-08-06 16:29:54    阅读次数:101
Leetcode-204(Java) Count Primes
Description:Count the number of prime numbers less than a non-negative number,n.传送门:https://leetcode.com/problems/count-primes/尽可能把查找次数缩小,直接用双重for会超时。...
分类:编程语言   时间:2015-08-05 10:27:34    阅读次数:366
(第五天)数组
概念数组是值的有序集合。每个值叫做一个元素,而每个元素在数组中有一个位置,以数字表示,称为索引。创建数组(1)使用数组直接量是创建数组最简单的方法,在方括号中将数组元素用逗号隔开即可。1 var empty = []; //没有元素的数组2 3 var primes= [2, 3, 5, 7, .....
分类:编程语言   时间:2015-08-04 00:08:12    阅读次数:197
EularProject 37:双向可截素数
Truncatable primes Problem 37 The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 7...
分类:其他好文   时间:2015-07-30 13:43:24    阅读次数:148
HDU - 2161 - Primes (质数)
Primes Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 8959    Accepted Submission(s): 3754 Problem Description Write a program to ...
分类:其他好文   时间:2015-07-27 15:07:30    阅读次数:91
leetcode-204-Count Primes
Count Primes Description: Count the number of prime numbers less than a non-negative number, n. 题目 Count Primes 计算小于n的所有素数的总数。 用一般的方法超时,应该用筛选法求素数 ,参考 筛选法求素数 class Solution { publ...
分类:其他好文   时间:2015-07-26 21:01:15    阅读次数:164
Project Euler:Problem 77 Prime summations
It is possible to write ten as the sum of primes in exactly five different ways: 7 + 3 5 + 5 5 + 3 + 2 3 + 3 + 2 + 2 2 + 2 + 2 + 2 + 2 What is the first value which can be written as the sum o...
分类:其他好文   时间:2015-07-18 18:40:05    阅读次数:118
Prime counting,sum of primes,leetcode,dp.
主要参考 http://www.zhihu.com/question/29580448/answer/45218281https://projecteuler.net/thread=10;page=5 Lucy_Hedgehog的代码如果不用map,自己写hash函数会更快// 计算 Π(n-1)c...
分类:其他好文   时间:2015-07-16 19:35:37    阅读次数:166
Count Primes -- leetcode
Description: Count the number of prime numbers less than a non-negative number, n. 基本思路:筛法 1, 2 为素数, 筛掉以2为因子的数。 即 2 * 2, 2*3, 2*4,2*5 2, 寻找到下一个未被筛除的数,如3.  再筛掉以3为因子的数。 3, 重复步骤2. 时间复杂度为O(n) ...
分类:其他好文   时间:2015-07-12 15:42:46    阅读次数:90
339条   上一页 1 ... 22 23 24 25 26 ... 34 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!