码迷,mamicode.com
首页 >  
搜索关键字:prime    ( 2475个结果
各种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
URAL 1091. Tmutarakan Exams 容斥
从1到s选出k个数 他们的最大公约数大于1 求方案数 容斥 S(1)-S(2)+S(3) S(x)为选出k个数的公因子个数为x的数量 #include #include #include using namespace std; typedef long long LL; const int maxn = 55; int prime[maxn], vis[maxn]; int n, m;...
分类:其他好文   时间:2014-11-07 11:21:15    阅读次数:146
C++ Primer第九章课后编程题
C++ Primer第五版这本书是久负盛名的C++经典教程,本篇博文为C++Primer(第五版)中文版第九章课后编程习题解答。...
分类:编程语言   时间:2014-11-07 09:57:06    阅读次数:267
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!