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

Method getAns1

src/class187/Code02_Cobweb1.java:240–250  ·  view source on GitHub ↗
(int u, int fa)

Source from the content-addressed store, hash-verified

238 }
239
240 public static void getAns1(int u, int fa) {
241 siz[u] = 1;
242 for (int e = head1[u]; e > 0; e = next1[e]) {
243 int v = to1[e];
244 if (v != fa) {
245 getAns1(v, u);
246 siz[u] += siz[v];
247 ans1 = ans1 * power(weight1[e], (long) siz[v] * (n - siz[v])) % MOD;
248 }
249 }
250 }
251
252 public static void main(String[] args) throws Exception {
253 FastReader in = new FastReader(System.in);

Callers 1

mainMethod · 0.95

Calls 1

powerMethod · 0.95

Tested by

no test coverage detected