摘要:
分析 题目实际上是在要在给定的边上构建出一个树,使得这个树的最长边尽可能小。 这实际上是最小生成树的性质(反证法)。问题从而得到解决。 代码 C++ / Code name = csp201812 5.cc Written by Sam X Date: 三月, 12, 2019 Time: 10:1 阅读全文
摘要:
分析 把具体的情况一个一个实现即可,没有什么幺蛾子。 代码 java class Solution { public int romanToInt(String s) { int ans = 0; for (int i=0; i!=s.length(); ++i) { switch(s.charAt 阅读全文
摘要:
代码 java for(int i=0; i!=n; ++i) { int u = cin.nextInt(); int v = cin.nextInt(); edges.add(new Edge(u,v)); startpnt = u; if(g.get(u)==null) g.put(u, ne 阅读全文