题目: 题解:
class Solution {const int MOD 1337;int pow(int x, int n) {int res 1;while (n) {if (n % 2) {res (long) res * x % MOD;}x (long) x * x % MOD;n / 2;}return res;}public:int superPow(int a, vector<int> &b) {int an…
题目: 题解:
class Solution {static final int MOD 1337;public int superPow(int a, int[] b) {int ans 1;for (int e : b) {ans (int) ((long) pow(ans, 10) * pow(a, e) % MOD);}return ans;}public int pow(int x, int n) {int res 1;while (n…
解法 a x 2 − x 1 y 2 − y 1 , b y 1 − a x 1 a\frac{x_{2}-x_{1}}{y_{2}-y_{1}} ,by_{1}-ax_{1} ay2−y1x2−x1,by1−ax1 d y n − y n − 1 x n − x n − 1 d\frac{y_{n}-y_{n-1}}{x_{n}-x_{n-1}} dxn−xn−1yn…