码迷,mamicode.com
首页 >  
搜索关键字:calculate prime s    ( 3428个结果
素数筛
这是我目前知道的打素数表最快的方法了………… 差不多是O(n)的,100000以内花了0.005秒。 1 int prime[100005], np, vis[100005]; 2 3 void get_prime(int n){ 4 mset(prime); mset(vis); 5 ...
分类:其他好文   时间:2014-05-30 23:26:36    阅读次数:204
Leetcode: Best Time to Buy and Sell Stock
My original thought was to calculate all the possible transactions by using nested loop. But got time limit excess error.I knew it can be done in O(n)...
分类:其他好文   时间:2014-05-29 20:44:37    阅读次数:271
Brute-forced Euclid Distance Transform
Sepearable 2D EDT, going to extend to 3D in order to calculate the Signed Distance Function(Field)Cost 0.75s to generate the SDF at 768^2
分类:其他好文   时间:2014-05-28 03:13:14    阅读次数:276
ZOJ 3772 Calculate the Function 线段树+矩阵
Calculate the FunctionTime Limit:2000MSMemory Limit:65536KB64bit IO Format:%lld & %lluSubmitStatusAppoint description:DescriptionYou are given a list ...
分类:其他好文   时间:2014-05-27 18:03:16    阅读次数:394
欧拉项目007:第10001个素数
10001st prime Problem 7 By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? 使用埃拉托斯特尼筛法,不懂得自行Wiki 我的py...
分类:其他好文   时间:2014-05-26 05:35:25    阅读次数:248
hdu2136Largest prime factor (关建在求素数,有点意思的题)
Problem Description Everybody knows any number can be combined by the prime number. Now, your task is telling me what position of the largest prime factor. The position of prime 2 is 1, prime 3 is ...
分类:其他好文   时间:2014-05-26 04:29:14    阅读次数:371
HDU4033:Regular Polygon(二分+余弦定理)
Problem Description In a 2_D plane, there is a point strictly in a regular polygon with N sides. If you are given the distances between it and N vertexes of the regular polygon, can you calculate t...
分类:其他好文   时间:2014-05-26 03:50:40    阅读次数:252
uva10780Again Prime? No Time.
质因数分解。 1 //Accepted 0 KB 12 ms 2 #include 3 #include 4 #include 5 const int MAXN = 100005; 6 const int inf = 100000000; 7 int pri[MAXN]; 8 in...
分类:其他好文   时间:2014-05-25 23:10:33    阅读次数:283
Prime Ring Problem
Prime Ring ProblemTime Limit : 4000/2000ms (Java/Other)Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 27Accepted Submission(s) : 10Font...
分类:其他好文   时间:2014-05-25 19:47:04    阅读次数:228
2014辽宁ACM省赛 Prime Factors
问题 L: Prime Factors 时间限制: 1 Sec  内存限制: 128 MB 提交: 36  解决: 28 [提交][状态][论坛] 题目描述 I'll give you a number , please tell me how many different prime factors in this number. 输入 There is multiple te...
分类:其他好文   时间:2014-05-24 20:52:54    阅读次数:311
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!