1 public static String[] array_unique(String[] a) {2 Set set = new HashSet();3 set.addAll(Arrays.asList(a));4 return set.toArray(new String[0]);5 }
分类:
其他好文 时间:
2014-08-06 18:38:11
阅读次数:
215
题目:
给定一棵树和一些路径 问 最多能选出多少路径放在树上 使得各个路径间没有点交叉
思路:
LCA+贪心
对于一条路径 我们可以将它分成两部分 即 从u到lca 和 从v到lca 易知lca位于树上深度最浅的地方 而且如果这个lca被一条路径覆盖了 那么下面的子树都相当于被覆盖了
考虑到以x点为上述的lca点 那么如何选择经过x的路径呢 可以想到如果一条路...
分类:
其他好文 时间:
2014-08-06 14:51:44
阅读次数:
180
DescriptionUnidirectional TSPBackgroundProblems that require minimum paths through some domain appear in many different areas of computer science. For...
分类:
其他好文 时间:
2014-08-06 14:16:41
阅读次数:
336
Paths on the tree
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 297 Accepted Submission(s): 93
Problem Description
bobo has a tr...
分类:
其他好文 时间:
2014-08-06 11:52:11
阅读次数:
284
约束的目的就是确保表中的数据的完整性。常用的约束类型如下:主键约束:(Primary Key constraint) 要求主键列唯一,并且不允许为空唯一约束:(Unique Constraint)要求该列唯一,允许为空,但只能出现一个空值检查约束:(Check Constraint)某列取值范围限制...
分类:
数据库 时间:
2014-08-05 22:30:40
阅读次数:
304
lca。。。
排个序然后暴力保平安
_(:зゝ∠)_
#pragma comment(linker, "/STACK:102400000,102400000")
#include"cstdio"
#include"iostream"
#include"set"
#include"queue"
#include"string.h"
using namespace std;
#define...
分类:
其他好文 时间:
2014-08-05 19:25:00
阅读次数:
299
Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space i...
分类:
其他好文 时间:
2014-08-05 18:09:19
阅读次数:
168
题目原文:
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of
S is 1000, and there exists one unique longest palindromic substring.
题意解析:
最长回文子串。就是...
分类:
其他好文 时间:
2014-08-05 15:56:59
阅读次数:
290
链接:http://poj.org/problem?id=1679
题意:告诉你有n个点,m条边,以及m条边的信息(起点、终点、权值),判断最小生成树是否唯一
判断MST是否唯一的思路是这样:对于每条边如果有和他相等权值的边,则做一个标记,然后进行一遍kruskal或prim找出最小生成树权值,然后对于每个使用过并且有相等边标记的边,把它从图中删去,再进行一遍kruskal或prim,...
分类:
其他好文 时间:
2014-08-05 14:12:39
阅读次数:
308
Non-unique ElementsYou are given a non-empty list of integers (X). For this task, you should return a list consisting of only the non-unique elements ...
分类:
其他好文 时间:
2014-08-05 10:48:49
阅读次数:
210