码迷,mamicode.com
首页 >  
搜索关键字:calculate prime s    ( 3428个结果
EOJ2067 最小生成树
EOJ2067 最小生成树 prime算法和kruskal算法实现   题目:   Building Roads Time Limit:1000MS Memory Limit:30000KB Total Submit:476 Accepted:144 Description Farmer John had just acquired...
分类:其他好文   时间:2014-12-08 21:30:49    阅读次数:355
哥德巴赫猜想
要求:               验证100以内的正偶数都能分解为两个素数之和,即验证哥德巴赫猜想对100以内(大于2)的正偶数成立。 技术要点:       为了验证哥德巴赫猜想对100以内(大于2)的正偶数是成立的,要将正偶数分解为两部分,再对这两部分进行判断,如果均是素数则满足,不是则重新进行分解继续判断。本实例把素数的判断过程自定义到prime()函数中,对每次分解出的两个数只要调...
分类:其他好文   时间:2014-12-08 15:34:35    阅读次数:164
How to calculate a good InnoDB log file size
Peter wrote a post a while ago aboutchoosing a good InnoDB log file size. Not to pick on Peter, but the post actually kind of talks about a lot of th...
分类:数据库   时间:2014-12-08 02:00:52    阅读次数:361
hdu1016 Prime Ring Problem
//经典搜索题 #include #include using namespace std;int primelist[38] = {0,0,1,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1};//素数表,...
分类:其他好文   时间:2014-12-07 20:19:30    阅读次数:241
[PAT]素因子分解(20)
#include "stdio.h"#include "math.h"long Prime(long);long PrimeCount(long,long);int main(){ int a,curPrime,cfCount; int v; int tPrime=0; sc...
分类:其他好文   时间:2014-12-07 20:15:43    阅读次数:292
HDU5139:Formula(找规律+离线处理)
http://acm.hdu.edu.cn/showproblem.php?pid=5139Problem Descriptionf(n)=(∏i=1nin?i+1)%1000000007You are expected to write a program to calculate f(n) wh...
分类:其他好文   时间:2014-12-07 11:15:53    阅读次数:197
HDU2136_Largest prime factor【水题】【筛法求素数】
题目大意:每个素数在素数表中都有一个序号,设1的序号为0,则2 的序号为1,3的序号为2,5的序号为3,以此类推。现在要求输出所 给定的数n的最大质因子的序号,0<n<1000000。 思路:巧用素数打表法。用sum计算素数的序号,将素数连同他的倍 数一起置为它的素数序号,从小到大循环,这样数组里存放的序号就 是最大素数因子的序号了。 注意:初始化时令所有数为0,Prime[0] = Prime[1] = 1。 即Prime[i]为0是素数,Prime[i]为1为素数。改变之后Prime[i]为数i 的最大...
分类:其他好文   时间:2014-12-07 00:11:24    阅读次数:178
HDU2710_Max Factor【水题】【筛法求素数】
题目大意:给你N个数,求这N个数中哪个数的最大素因子最大, 输出这个数,如果有多种结果,输出靠前边的那个数。 思路:将筛法求素数改变一下。若i为素数,则i的1、2、3…倍的 最大素因子都为i,筛的时候,赋值为Prime[j] = i,即j的最大素因 子为i。 注意:初始化时令所有数为0,Prime[0] = Prime[1] = 1。 即Prime[i]为0是素数,Prime[i]为1为素数。改变之后Prime[i]为 i的最大素因子。...
分类:其他好文   时间:2014-12-07 00:09:16    阅读次数:730
poj 2318 TOYS (点与线段位置关系判断)
TOYS Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 10848   Accepted: 5206 Description Calculate the number of toys that land in each bin of a partitioned...
分类:其他好文   时间:2014-12-06 14:09:23    阅读次数:214
BFS/poj 3126 prime path
1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int n,x,y; 7 bool v[20000]; 8 struct point 9 {10 int x;11 int step;12 };...
分类:其他好文   时间:2014-12-05 22:34:01    阅读次数:245
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!