摘要:
Problem 给出一个不带边权(即边权为1)的有向无环图(unweighted DAG)以及DAG上两点s, t,求s到t的最短距离,如果无法从s走到t,则输出-1。 Solution DFS,BFS都可,对于unweighted DAG, BFS更合适,下面给出DFS解法。 对于weighted 阅读全文
摘要:
传送门 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 阅读全文