码迷,mamicode.com
首页 >  
搜索关键字:bear and prime numbe    ( 2904个结果
HDU2138 随机素数测试 Miller-Rabin算法
题目描述 Give you a lot of positive integers, just to find out how many prime numbers there are.. In each case, there is an integer N representing the num...
分类:其他好文   时间:2014-07-30 23:35:35    阅读次数:300
HDU 1016 Prime Ring Problem (素数筛+DFS)
题目链接题意 : 就是把n个数安排在环上,要求每两个相邻的数之和一定是素数,第一个数一定是1。输出所有可能的排列。思路 : 先打个素数表。然后循环去搜。。。。。 1 //1016 2 #include 3 #include 4 #include 5 6 using namespace std...
分类:其他好文   时间:2014-07-30 23:08:45    阅读次数:172
hdu 1016 Prime Ring Problem
http://acm.hdu.edu.cn/showproblem.php?pid=1016题意:给你一个数n,让1~n数形成相邻两个数的和是个素数的环,并把环的序列输出 1 #include 2 #include 3 #include 4 #define maxn 100 5 using n...
分类:其他好文   时间:2014-07-30 20:29:04    阅读次数:202
c语言实现hashtable,类似C++的map和iOS的NSDictionary
跟线性数组和链表不同,HashTable是快速查找的数据结构。本文中的HashTable使用链表处理数组。 该HashTable可以指定table的长度,提供了遍历的方法。包括table的长度的选择也比较讲究。 cp_int32 nPrime[MAX_HASH_PRIME_ARRAY_NUM] = { 17, 37, 79, 163, 331, 673, 1361 }; 就是说table的长度来取自上面这个数组。比如用户设定了200,那么ta...
分类:移动开发   时间:2014-07-30 17:26:14    阅读次数:380
hdoj 1016 Prime Ring Problem 【DFS】
策略如题 链接 http://acm.hdu.edu.cn/showproblem.php?pid=1016 代码: #include #include int prime[25] = {1, 1}, n, vis[25]; //vis作用:标记是否用过 int a[25]; void f() //找出来前20的素数 判定为0 { for(int i = 2; i <= 24; i ++...
分类:其他好文   时间:2014-07-30 14:57:03    阅读次数:280
[poj 2417]Discrete Logging 数论 BSGS
Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 3516   Accepted: 1651 Description Given a prime P, 2 31, an integer B, 2 BL == N (mod P) Input Read severa...
分类:其他好文   时间:2014-07-30 12:27:53    阅读次数:331
最短路径之Kurskal
个人观点,较prime算法,Kurskal算法更加的简单,这里我们只需要每一次去需找权值最小的那条边就好,在这里我们先可以利用sort进行快排,得到权值最小的map[i] 。 得到该条边的两个节点map[i].u 和map[i].v,这时候你需要判断能不能用这条边,因为最小生成树是不能形成回路,所以...
分类:其他好文   时间:2014-07-30 11:45:03    阅读次数:219
codeforces 17A Noldbach problem
Noldbach problem time limit per test 2 seconds memory limit per test 64 megabytes input standard input output standard output Nick is interested in prime numbers. Once h...
分类:数据库   时间:2014-07-30 01:07:23    阅读次数:308
Codeforces 237C
题目:DescriptionYou've decided to carry out a survey in the theory of prime numbers. Let us remind you that a prime number is a positive integer that ha...
分类:其他好文   时间:2014-07-29 10:25:58    阅读次数:395
POJ1811 Prime Test(miller素数判断&&pollar_rho大数分解)
http://blog.csdn.net/shiyuankongbu/article/details/9202373发现自己原来的那份模板是有问题的,而且竟然找不出是哪里的问题,所以就用了上面的链接上的一份代码,下面只是寄存一下这份代码,以后打印出来当模板好了。#pragma warning(dis...
分类:其他好文   时间:2014-07-28 23:36:34    阅读次数:250
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!