码迷,mamicode.com
首页 >  
搜索关键字:prime    ( 2475个结果
区间素数筛
题目描述 A positive integer is called a "prime-factor prime" when the number of its prime factors is prime. For example, 12 is a prime-factor prime becaus ...
分类:其他好文   时间:2019-08-21 00:13:23    阅读次数:77
[HDU - 2682]Tree
最小生成树。 题意就是有N座城市,每个城市有一定的幸福值a[i]。对于任意两个城市i和j,如果a[i],a[j],a[i]+a[j]中任意一者的值为素数,那么他们的边权就是min(min(a[i],a[j]),abs(a[i]-a[j]))。问题就是这一幅图的最小生成树。显然,边一旦建出来了,这就是 ...
分类:其他好文   时间:2019-08-20 21:56:52    阅读次数:72
Java容器
一,list集合排序 对于自定义数据类型,排序可以用Collections集合工具类中的sort()方法, 而要想使用sort()方法则必须实现Comparable接口然后重写里面的compareTo方法或单独一个类实现Comparactor接口也重写里面的compareTo方法 String类型已 ...
分类:编程语言   时间:2019-08-18 15:26:05    阅读次数:80
二次剩余系解法
(Note: All are taken to mean , unless indicated otherwise).[edit]The algorithm Inputs: p, an odd prime. n, an integer which is a quadratic residue (mo ...
分类:其他好文   时间:2019-08-17 00:48:36    阅读次数:94
C - Co-prime
Given a number N, you are asked to count the number of integers between A and B inclusive which are relatively prime to N. Two integers are said to be ...
分类:其他好文   时间:2019-08-15 22:45:15    阅读次数:106
Co-prime 杭电4135
Given a number N, you are asked to count the number of integers between A and B inclusive which are relatively prime to N. Two integers are said to be ...
分类:其他好文   时间:2019-08-15 21:10:45    阅读次数:89
Half Nice Years Gym - 101840H (点分治 or 并查集)
题目 https://cn.vjudge.net/problem/Gym-101840H 题意 给出一棵树,问有多少对点,将他们之间的边权相乘之后所获得的值仅有两个不同的质因子。 题解 当时没想着用并查集做,写了个点分治= =。我们对于重心的子树挨个搜索,用number数组记录下质因子数量为0, 1 ...
分类:其他好文   时间:2019-08-15 21:04:33    阅读次数:86
Prime Path POJ - 3126(简单广搜)
题目链接:https://cn.vjudge.net/problem/POJ-3126 注意:预处理1000-9999间的素数,并且对入过队列的数进行标记,防止重复入队,否则超时 ...
分类:其他好文   时间:2019-08-15 10:58:50    阅读次数:93
数论——HDU - 2136
题目链接 题目含义 找出一个数最大素数因子的序号 题目分析 我们可以在筛素数的同时,用这个素数标记它的倍数,说明这些倍数一定有它这个素数因子 这样筛一遍下来,一个数大的素数因子就会覆盖它小的素数因子 题目代码 ...
分类:其他好文   时间:2019-08-14 17:31:04    阅读次数:65
POJ 3126 - Prime Path--BFS
题目链接: http://poj.org/problem?id=3126 题意: 给出两个四位质数,每次操作可以改变该质数的一位数字,问最少要多少步可以从第一个质数到第二个质数。 代码: ...
分类:其他好文   时间:2019-08-14 17:29:09    阅读次数:101
2475条   上一页 1 ... 23 24 25 26 27 ... 248 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!