最裸的反素数问题。求不大于N的数约数最多的数是多少,如果有多个求最小值。 设x的约数个数为g(x),如果有某个正整数a有对于任意0=t2>=t3>=.... 有了这些性质之后,就可以用dfs搜索质因子来求值了 搜索过程如下: 在保证性质1和2的情况下构造出一定长度的指数数组,指数数组的每一个情况就相...
分类:
其他好文 时间:
2014-07-16 21:31:38
阅读次数:
212
题意就是给出一个f值,然后假如两个点u,v间的所有路径上的最大边中的最小值大于f,那么这个点对是合法的,对于每个询问f,输出有多少个合法点对。最大边最小就是最小瓶颈路,即最小生成树上的路径。一个简单的想法就是求出最小生成树后,n次dfs求出任意两点间的最大边,然后对于每个询问再查找一遍,可是时间复杂...
分类:
其他好文 时间:
2014-07-16 20:59:37
阅读次数:
206
时间限制:0.75s空间限制:6M题意 n*n(n>1; r同理,即rint n, sum, max, k, m;void dfs (int line , int row, int l, int r, int k) { int pos, p, i; if (line > n){ ...
分类:
其他好文 时间:
2014-07-11 17:59:56
阅读次数:
358
poj1753 Flip Game(枚举Enum+dfs)...
分类:
其他好文 时间:
2014-07-11 00:57:41
阅读次数:
251
ERROR namenode.NameNode: java.io.IOException: Cannot lock storage /tmp/hadoop-root/dfs/name. The directory is already locked....
分类:
其他好文 时间:
2014-07-11 00:23:43
阅读次数:
362
Oil Deposits
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 11360 Accepted Submission(s): 6626
Problem Description
The GeoSurvComp ...
分类:
其他好文 时间:
2014-07-10 23:11:40
阅读次数:
239
POJ2965 The Pilots Brothers' refrigerator(直接计算或枚举Enum+dfs)...
分类:
其他好文 时间:
2014-07-10 21:18:20
阅读次数:
188
树的直径即树中最长的路径的长度。
用两次dfs,第一次从任意点出发求得一个最远点p,
第二次从p出发求得最远点,这条路径就是最长路,即所求。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define inf 0x3f3f3f3f
#define...
分类:
其他好文 时间:
2014-07-10 19:46:15
阅读次数:
197
题目大意:
说七个party选择数字(各不相同)
而规定的小象的party选择的数字之中所拥有的数字4和7的个数要比其他六个party拥有的个数之和还要严格多,询问方案数。
如m=7时其余的随意选择至少会拥有一个4或7,与题意矛盾,故方案数为0
m=8时,7 1 2 3 5 6 8是一种合法方案
思路:
由于小象的party选到的数字所含4和7的个数至多和m的位数一样多,则枚举小象的party所含4和7的个数,剩余的6个party直接用dfs即可(直接用乘法原理)。
而通过数位dp可以算出1~m之中所拥有...
分类:
其他好文 时间:
2014-07-10 19:44:26
阅读次数:
193
Description
Starting with x and repeatedly multiplying by x, we can compute x31 with thirty multiplications:
x2 = x × x, x3 = x2 × x, x4 = x3 × x, …, x31 = x30 × x.
The operation of squarin...
分类:
其他好文 时间:
2014-07-10 17:36:07
阅读次数:
202