Problem Description推断两序列是否为同一二叉搜索树序列Input開始一个数n,(1#include #include using std::string;using std::cin;const int SIZE = (1>root; for (int i = 0; i >chi....
分类:
其他好文 时间:
2014-07-11 18:44:26
阅读次数:
205
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4085138559951339Ancient CipherAcceptedC++0.0122014...
分类:
其他好文 时间:
2014-07-11 09:55:46
阅读次数:
236
In the classic problem of the Towers of Hanoi, you have 3 towers and Ndisks of different sizes which can slide onto any tower.The puzzle starts with d...
分类:
其他好文 时间:
2014-07-11 09:45:26
阅读次数:
254
Conversion rules are more complicated when unsigned operands are involved. The problem is that comparisons between signed and unsigned values are mach...
分类:
编程语言 时间:
2014-07-11 08:50:41
阅读次数:
347
题目链接:uva 10837 - A Research Problem
题目大意:给定一个phin,要求一个最小的n,欧拉函数n等于phin
解题思路:欧拉函数性质有,p为素数的话有phip=p?1;如果p和q互质的话有phip?q=phip?phiq
然后根据这样的性质,n=pk11(p1?1)?pk22(p2?1)???pkii(pi?1),将所有的pi处理出来,暴力搜索维护最小...
分类:
其他好文 时间:
2014-07-11 00:59:42
阅读次数:
270
http://202.121.199.212/JudgeOnline/problem.php?cid=1078&pid=17
分析: 直接暴力了。。。
代码:
#include
#include
using namespace std;
#define MAXN 2004
#define inf 0x3f3f3f3f
int k[MAXN],f[MAXN];
in...
分类:
其他好文 时间:
2014-07-11 00:47:06
阅读次数:
223
http://202.121.199.212/JudgeOnline/problem.php?cid=1078&pid=9
分析:
a[ i ] : 第i个城市的汽油与到下一个城市距离的差;
dis[ i ] : 第i个城市到下一个城市的距离;
s[ i ] : 前i个 a[ i...
分类:
其他好文 时间:
2014-07-11 00:20:56
阅读次数:
377
http://202.121.199.212/JudgeOnline/problem.php?cid=1078&pid=7
分析: 经典DP题
dp[ i ][ j ]:前i个水晶搭建的高度差为 j 的双塔中较高塔的高度;
dp[ i ][ j ] = d[ i-1 ][ j ] , ...
分类:
其他好文 时间:
2014-07-10 22:25:43
阅读次数:
304
链接:http://vjudge.net/problem/viewProblem.action?id=22169描述:有n个漏洞,m个修复漏洞的方法,每种方法耗时不一样,求修复漏洞的最短时间。每种方法的使用对当前漏洞分布的状态有要求,符合要求才能修复,并有可能引入新漏洞。思路:单源点最短路 这...
分类:
其他好文 时间:
2014-07-10 16:42:58
阅读次数:
268
有一个无权的图G,使用某个顶点s作为输入参数,找出从s到其它顶点的最短路径。这样,只要计算包含在路径中的边数就可以了。比如,一个word ladder problem,一次只变换一个字母,找出从fool到sage的最短路径。可用的单词可以转化为一个图:首先寻找与fool距离为1的顶点:然后可以寻找距...
分类:
其他好文 时间:
2014-07-10 14:46:41
阅读次数:
239