码迷,mamicode.com
首页 >  
搜索关键字:reversible primes    ( 347个结果
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
质数筛选方法(埃拉托斯特尼筛法)
今天刷题刷了这么一道题, The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. 大概意思是10以内的质数加法和为 2 + 3 + 5 + 7 = 17,接着求2000000以内质数加法的和。 分析:要求2000000内质数的和,首先得把...
分类:其他好文   时间:2015-07-11 09:18:17    阅读次数:137
LeetCode Count Primes 求素数个数
题意:给一个数n,返回小于n的素数个数。思路: 1 class Solution { 2 public: 3 int countPrimes(int n) { 4 bool* isPrime =new bool[n] ; 5 6 memset...
分类:其他好文   时间:2015-06-26 22:19:55    阅读次数:123
Leetcode--easy系列9
#198 House Robber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them...
分类:其他好文   时间:2015-06-25 21:16:15    阅读次数:110
Count Primes ——LeetCode
Description:Count the number of prime numbers less than a non-negative number,n.题目大意:给一个int,返回小于它的质数的数量。解题思路:打表。public class Solution { public ...
分类:其他好文   时间:2015-06-25 11:55:16    阅读次数:93
347条   上一页 1 ... 23 24 25 26 27 ... 35 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!