摘要: "原题链接" 思路: 如果有环,则起点一定为“1”。如果没有可以胜过“1”的,则无环。 根据W,L来建立图,用dfs从1节点遍历+回溯。 剪枝:dfs到某个子序列时,如果当前未访问节点无法与1节点构成回路,就不往下搜索。 import java.util. ; public class Main { 阅读全文
posted @ 2018-11-16 20:36 Ruohua3kou 阅读(273) 评论(0) 推荐(0) 编辑
摘要: ``` import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int times = 0; whil... 阅读全文
posted @ 2018-11-16 00:29 Ruohua3kou 阅读(284) 评论(0) 推荐(0) 编辑
摘要: ``` import java.util. ; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String n = sc.next(); Map ma 阅读全文
posted @ 2018-11-16 00:09 Ruohua3kou 阅读(326) 评论(0) 推荐(0) 编辑