摘要: Problem 给出一个不带边权(即边权为1)的有向无环图(unweighted DAG)以及DAG上两点s, t,求s到t的最短距离,如果无法从s走到t,则输出-1。 Solution DFS,BFS都可,对于unweighted DAG, BFS更合适,下面给出DFS解法。 对于weighted 阅读全文
posted @ 2015-09-19 22:47 Pat 阅读(369) 评论(0) 推荐(0) 编辑
摘要: 传送门 You are given $n$ numbers $a_1, a_2, \dots, a_n$. You can perform at most $k$ operations. For each operation, you can multiply one of the numbers 阅读全文
posted @ 2015-09-19 08:27 Pat 阅读(359) 评论(0) 推荐(0) 编辑