MCPcopy Create free account
hub / github.com/algorithmzuo/algorithm-journey / main

Method main

src/class187/Code02_Cobweb1.java:252–274  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

250 }
251
252 public static void main(String[] args) throws Exception {
253 FastReader in = new FastReader(System.in);
254 PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
255 n = in.nextInt();
256 for (int i = 1, u, v, w, c; i < n; i++) {
257 u = in.nextInt();
258 v = in.nextInt();
259 w = in.nextInt();
260 c = in.nextInt();
261 addEdge1(u, v, w, c);
262 addEdge1(v, u, w, c);
263 }
264 cntn = n;
265 cnt2 = 1;
266 ans1 = ans2 = 1;
267 getAns1(1, 0);
268 rebuild(1, 0);
269 getAns2(1);
270 long ans = ans1 * power(ans2, MOD - 2) % MOD;
271 out.println(ans);
272 out.flush();
273 out.close();
274 }
275
276 // 读写工具类
277 static class FastReader {

Callers

nothing calls this directly

Calls 9

nextIntMethod · 0.95
addEdge1Method · 0.95
getAns1Method · 0.95
rebuildMethod · 0.95
getAns2Method · 0.95
powerMethod · 0.95
printlnMethod · 0.45
flushMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected