You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
359 B

#include <bits/stdc++.h>
using namespace std;
#define int long long
// 快速幂
int qmi(int a, int b) {
int res = 1;
while (b) {
cout << "b = " << (b & 1) << ", a = " << a << endl;
if (b & 1) res = res * a;
b >>= 1;
a = a * a;
}
return res;
}
signed main() {
cout << qmi(2, 10) << endl;
}