码迷,mamicode.com
首页 >  
搜索关键字:not find    ( 24186个结果
POJ 1703 Find them, Catch them(数据结构-并查集)
题目大意: T组测试数据,n个人,m组询问,2个帮派,D a b 表示 a,b 不在同一帮派 ,A a b表示查询a和b的关系。 解题思路: 并查集。将每个人对应两个节点,分属于两个帮派。1~n表示帮派1中的,n+1~2n表示帮派2中的。若知道a和b不是同一帮的,那么将a和b+n放到一个集合中,b和a+n放到一个集合中。并查集查询a和b的关系时,如果a与b+n在一个集合中,则说明他们不在同一帮;若a和b在同一集合,则在同一帮;否则说明他们关系不确定。连线时交叉连,即保证间隔两人在同一集合。即敌人的敌人是朋友...
分类:其他好文   时间:2014-08-03 18:12:36    阅读次数:302
leetcode Word Break II
Give two versions of WA code: Version 1: Runtime Error: Find the bug class Solution { public: void find(const string& s, const unordered_set& dict, vector& res) { int i, j, len = s.length(); ...
分类:其他好文   时间:2014-08-03 15:21:27    阅读次数:329
POJ 1703 Find them, Catch them (并查集)
题目大意: 有n个罪犯被逮到。他们分别属于两个团伙。而且每个团伙里至少有一个人 D a b 说明 a b 不是一个团伙的。 A a b 询问a b 是不是一个团伙的。 思路分析: 开始想的是如果a b 不是一个团伙,就把a 和 n+1 并,b和n+2 并。 但是看看下面这组数据就知道是错了。 1 4 4 D 1 2 D 3 4 D 1 4 A 1 3 不是直接...
分类:其他好文   时间:2014-08-03 15:17:35    阅读次数:182
MongoDB权威指南学习笔记5---索引相关的知识点
1 查看查询计划 db.user.find({"username":"xxx"}) .explain() db.doc.find({"es_y":"2014"}).explain() { ?"cursor" : "BasicCursor", ?"isMultiKey" : false, ?"n" : 0, ?"nscannedObjects" : 1, ?"nscann...
分类:数据库   时间:2014-08-03 12:56:45    阅读次数:268
hdu 2141 Can you find it?(二分查找)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2141题目大意:查找是否又满足条件的x值。这里简单介绍一个小算法,二分查找。 1 /* 2 3 x^2+6*x-7==y 4 输入y 求x 精确度为10^-5 5 0= 9 #includ...
分类:其他好文   时间:2014-08-03 12:40:35    阅读次数:175
MongoDB权威指南学习笔记4---查询相关的知识点
1 find find({查询条件},{"key":1,"email":1})? 后面表示返回哪些键 2 可用的比较操作符 $lt , $lte,$gt,$gte 比如db.users.find({"age":{"$gte":18,"$lte":30}}) 3不等于 find(...{"key":{"$ne":"value"}} 4 ...
分类:数据库   时间:2014-08-03 10:23:35    阅读次数:312
poj 1456 Supermarket (贪心+并查集)
# include # include # include using namespace std; int fa[10010]; struct node { int p; int d; }; struct node a[10010]; bool cmp(node a1,node a2)//利润从大到小 { return a1.p>a2.p; } int find(int x) {...
分类:其他好文   时间:2014-08-03 10:16:25    阅读次数:208
Triangle leetcode java
题目:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the....
分类:编程语言   时间:2014-08-03 04:40:04    阅读次数:351
[LeetCode]Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. /** * Definition for binary tree ...
分类:其他好文   时间:2014-08-02 23:32:04    阅读次数:232
37条常用Linux Shell命令组合
序号任务命令组合1删除0字节文件find . -type f -size 0 -exec rm -rf {} \;find . type f -size 0 -delete2查看进程,按内存从大到小排列ps -e -o “%C : %p : %z : %a”|sort -k5 -nr3按cpu利用率...
分类:系统相关   时间:2014-08-02 23:17:54    阅读次数:341
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!