列举目录中的所有文件
首先给出代码:
Files.list(Paths.get(".")).forEach(System.out::println);
Files.list方法得到的是一个Stream类型的对象,它代表了目标路径下所有的文件。如果只想获取目标路径下的所有目录文件:
Files.list(Paths.get("."))
.filter(Files...
分类:
编程语言 时间:
2014-10-24 11:00:57
阅读次数:
163
POJ 3177 Redundant Paths
题目链接
题意:给定一个连通无向图,问加几条边能使得图变成一个双连通图
思路:先求双连通,缩点后,计算入度为1的个数,然后(个数 + 1) / 2 就是答案(这题由于是只有一个连通块所以可以这么搞,如果有多个,就不能这样搞了)
代码:
#include
#include
#include
using namesp...
分类:
其他好文 时间:
2014-10-24 10:58:00
阅读次数:
108
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =...
分类:
其他好文 时间:
2014-10-22 07:36:22
阅读次数:
218
[leetcode]Unique Paths...
分类:
其他好文 时间:
2014-10-20 10:07:47
阅读次数:
228
[leetcode]Unique Paths II...
分类:
其他好文 时间:
2014-10-20 10:04:36
阅读次数:
170
题目链接:hdu 4912 Paths on the tree
题目大意:给定一棵树,和若干个通道,要求尽量选出多的通道,并且两两通道不想交。
解题思路:用树链剖分求LCA,然后根据通道两端节点的LCA深度排序,从深度最大优先选,判断两个节点均没被标
记即为可选通道。每次选完通道,将该通道LCA以下点全部标记。
#pragma comment(linker, "/STACK:1...
分类:
其他好文 时间:
2014-10-18 08:38:21
阅读次数:
230
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 is marked as 1 and 0 respectively
in the ...
分类:
其他好文 时间:
2014-10-15 16:48:01
阅读次数:
196
开发NDK的时候,如果JNI文件找不到C和C++的支持类,然后报很多很多红叉号,是因为没有设定“Paths and Symbol”.
分类:
其他好文 时间:
2014-10-15 15:57:40
阅读次数:
158
[leetcode]Unique Paths...
分类:
其他好文 时间:
2014-10-15 12:52:50
阅读次数:
170
今天 工程 中 用到了 libxml2.framwork 这个库 使用中 报错 “'libxml/tree.h' file not found”解决的 办法 是 从网上 谷歌到的 使用后 完美解决办法:Header Search Paths 增加一条 :${SDKROOT}/usr/include/...
分类:
其他好文 时间:
2014-10-14 17:27:58
阅读次数:
181