You are viewing a single comment's thread. Return to all comments →
C# one-line
public static int solve(int n, int m) { return n == 1 ? m%1000000007: (int)((BigInteger.ModPow(m-2, n-2,1000000007)*m*(m-1)) % 1000000007); }
..without BigInteger would be longer :)
Seems like cookies are disabled on this browser, please enable them to open this website
Anti-Palindromic Strings
You are viewing a single comment's thread. Return to all comments →
C# one-line
..without BigInteger would be longer :)