码迷,mamicode.com
首页 >  
搜索关键字:prime    ( 2475个结果
URAL 1748. The Most Complex Number 反素数
题目来源:URAL 1748. The Most Complex Number 题意:求一个小于等于n的因子最多的数 思路:搜索+剪枝 #include #include using namespace std; typedef unsigned __int64 LL; LL prime[16] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53...
分类:其他好文   时间:2014-08-22 21:12:09    阅读次数:228
projecteuler---->problem=35----Circular primes
Problem 35 The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13,...
分类:其他好文   时间:2014-08-22 17:52:39    阅读次数:185
sznoi b003
这题坑了我,原因是题目数据问题1000000告诉我100 OTL附代码 1 #include 2 #include 3 #include 4 using namespace std; 5 6 bool prime[1100000] = {0}; 7 8 void getlist(int m...
分类:其他好文   时间:2014-08-22 17:41:29    阅读次数:176
UVa10099_The Tourist Guide(最短路/floyd)(小白书图论专题)
解题报告 题意: 有一个旅游团现在去出游玩,现在有n个城市,m条路。由于每一条路上面规定了最多能够通过的人数,现在想问这个旅游团人数已知的情况下最少需要运送几趟 思路: 求出发点到终点所有路当中最小值最大的那一条路。 求发可能有多种,最短路的松弛方式改掉是一种,最小生成树的解法也是一种(ps,prime和dijs就是这样子类似的) #include #include #incl...
分类:其他好文   时间:2014-08-22 02:47:25    阅读次数:194
UVA 题目11292 Dragon of Loowater
Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. The shores of Rellau Creek in central Loowater had always been a prime...
分类:其他好文   时间:2014-08-21 17:23:54    阅读次数:153
Prime Cuts(poj1595)
/*Prime Cuts Description A prime number is a counting number (1, 2, 3, ...) that is evenly divisible only by 1 and itself. In this problem you are to write a program that will cut some number of pri...
分类:其他好文   时间:2014-08-21 17:14:24    阅读次数:283
uva 10780 Again Prime? No Time.
POINT : 质因子分解;(仅给题解)http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1721题意:给你两个整数m和n,求最大的k使...
分类:其他好文   时间:2014-08-21 14:50:14    阅读次数:233
Prime Palindromes
题目大意:求出区间[a,b]之间的回文质数。 a10000)13 break;14 check[c]=true;15 if (i % prime[j]==0)16 break;17 ...
分类:其他好文   时间:2014-08-21 14:34:14    阅读次数:192
[POJ 2407]Relatives(欧拉函数)
Description Given n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if there are no integers x > 1, y > 0, z > 0 such ...
分类:其他好文   时间:2014-08-20 22:41:13    阅读次数:264
【模版】素数筛, 最大公约数(辗转相除法),最小公倍数
素数筛: //数除了{2,3,5}为素数,其他的数可以写成6N,6N+1,6N+2,6N+3,6N+4,6N+5 N>=1 可以表示全部的数 //6N,6N+2,6N+4都为偶数,不是素数,6N+3 == 3(2N+1) 不是素数,那么就只筛6N+1和6N+5就可以了 int prime[1000000]={2,3,5}; void is_prime() { int i,j; ...
分类:其他好文   时间:2014-08-19 20:58:25    阅读次数:237
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!