//1.联通图 2.顶点度数都为偶数 ,则存在欧拉回路。
# include
# include
# include
using namespace std;
int father[1010];
int vis[1010][1010],du[1010];
int find(int x)
{
if(father[x]==x)
return x;
return f...
分类:
其他好文 时间:
2014-08-10 10:25:30
阅读次数:
218
题意:
一棵有权树,从根结点中放入 K 个机器人,求用这 K 个机器人遍历所有的结点最少的权值和。
思路:
1. dp[u][i] 表示给以 u 为根节点的子树放 i 个机器人,遍历其子树所需要的最小权值。
2. 关键在于 dp[u][0] 的理解,表示:最后停留在以 u 为根节点的子树下 0 个机器人,并且遍历了 u 子树的最小权值和。
3. 下面的步骤就变成和分组...
分类:
其他好文 时间:
2014-08-10 10:24:50
阅读次数:
215
First Missing PositiveGiven an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Yo...
分类:
其他好文 时间:
2014-08-09 23:13:29
阅读次数:
253
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.思路:对于两个点(x1,y1)和(x2,y2),其所确定的直线方程为:(x1-x2)*y + (y2-...
分类:
其他好文 时间:
2014-08-09 23:03:49
阅读次数:
317
Describe how you could use a single array to implement three stacks.思路1:fixed divisionpackage Question3_1;import java.util.EmptyStackException;public ...
分类:
其他好文 时间:
2014-08-09 22:59:29
阅读次数:
401
public static int num=0;
public static ThreadLocal> queueHoder = new ThreadLocal>();
private static String driver;
private static String url;
private static String username;
private static String...
分类:
数据库 时间:
2014-08-09 21:36:49
阅读次数:
490
Valid SudokuDetermine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are ...
分类:
其他好文 时间:
2014-08-09 21:20:39
阅读次数:
226
CentOS6.4安装readline时报错:/usr/bin/ld : cannot find -lncurses解决方法:安装ncurses-devel,输入命令:#yum install ncurses-devel###安装完成后重新安装readline(#pip install readli...
分类:
其他好文 时间:
2014-08-09 21:14:29
阅读次数:
1431
find the most comfortable road
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 3686 Accepted Submission(s): 1565
Problem Descript...
分类:
其他好文 时间:
2014-08-09 18:51:08
阅读次数:
229
CO-PRIME
时间限制:1000 ms | 内存限制:65535 KB
难度:3
描述
This problem is so easy! Can you solve it?
You are given a sequence which contains n integers a1,a2……an, your task is to find how man...
分类:
其他好文 时间:
2014-08-09 18:46:38
阅读次数:
244