码迷,mamicode.com
首页 >  
搜索关键字:bear and prime numbe    ( 2904个结果
POJ 2739 Sum of Consecutive Prime Numbers(素数)
POJ 2739 Sum of Consecutive Prime Numbers(素数)...
分类:其他好文   时间:2014-11-14 17:45:15    阅读次数:160
各种hash函数
public class HashAlgorithms { /** * 加法hash * @param key 字符串 * @param prime 一个质数 * @return hash结果 */ public static int additiveHash(String key, int pri...
分类:其他好文   时间:2014-11-14 10:43:05    阅读次数:148
HDU 2138 How many prime numbers
就是找素数。很水的题。模糊搜索一道题搜到的。 但是却 TLE 2次。把所有的 long long 改成 int ,%lld 改成 %d 就神奇的过了。 简直不可思议。 #include #include #include #include #include #include #include #include #include #include #include #include #def...
分类:其他好文   时间:2014-11-13 18:55:12    阅读次数:176
hdu 2122(Ice_cream’s world III)(最小生成树,两种算法都可以)
Ice_cream’s world III Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 926    Accepted Submission(s): 303 Problem Description ice_cr...
分类:编程语言   时间:2014-11-13 16:37:46    阅读次数:260
POJ2126——Prime Path(BFS)
Prime PathDescriptionThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to chang...
分类:其他好文   时间:2014-11-13 14:26:51    阅读次数:200
PAT 1059. Prime Factors
反正知道了就是知道,不知道也想不到,很快#include #include #include using namespace std;inline void print_prime_k(long long p, long long k) { printf("%lld", p); ...
分类:其他好文   时间:2014-11-12 20:59:25    阅读次数:211
[ACM] POJ 2689 Prime Distance (大区间素数筛选)
Prime Distance Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12811   Accepted: 3420 Description The branch of mathematics called number theory is about p...
分类:其他好文   时间:2014-11-12 13:51:21    阅读次数:248
hdu 1233(还是畅通project)(prime算法,克鲁斯卡尔算法)(并查集,最小生成树)
还是畅通projectTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 26860Accepted Submission(s): 11985Probl...
分类:编程语言   时间:2014-11-12 13:36:00    阅读次数:272
POJ 2739 Sum of Consecutive Prime Numbers(素数打表水题)
【题意简述】:题意很简单,就是用连续的素数加和,计算有多少个这样的连续的素数数列可以使这个序列的和等于输入的数。 【分析】:很经典的素数模板,基本所有有关素数的题,我都会使用这个模板。 // 268K 16Ms #include using namespace std; #define N 10000 bool isprime[N]; long long prime[1300],np...
分类:其他好文   时间:2014-11-10 21:50:41    阅读次数:264
poj The Luckiest number
The Luckiest numbe 题目:     在满足|x| + |y|最小时候,让a*|x| + b*|y|最小。求:|x| + |y|最小值。 算法:     同余式的求解运用。     解体步骤:     1、先用gcd判断是否有解。(c%g == 0有解)     2、对式子求最简式。a' = a/g ; b' = b/g; c' = c/g;     3、运...
分类:其他好文   时间:2014-11-08 15:17:08    阅读次数:80
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!