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

Method power

src/class187/Code02_Cobweb1.java:52–62  ·  view source on GitHub ↗
(long x, long p)

Source from the content-addressed store, hash-verified

50 public static long ans1, ans2;
51
52 public static long power(long x, long p) {
53 long ans = 1;
54 while (p != 0) {
55 if ((p & 1) != 0) {
56 ans = ans * x % MOD;
57 }
58 p >>= 1;
59 x = x * x % MOD;
60 }
61 return ans;
62 }
63
64 public static void addEdge1(int u, int v, int w, int c) {
65 next1[++cnt1] = head1[u];

Callers 3

dfsRightMethod · 0.95
getAns1Method · 0.95
mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected