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.

29 lines
518 B

2 years ago
#include <iostream>
using namespace std;
typedef long long LL;
const int mod = 1e9 + 7;
/*
:
10000000 10000000
999300007
*/
//快速乘计算a*b%mod
LL ksc(LL a, LL b) {
LL ans = 0;
a %= mod;
while (b) {
if (b & 1) ans = (ans + a) % mod;
b >>= 1; //位运算右移1位相当于除以2
a = (a + a) % mod;
}
return ans;
}
int main() {
LL a, b;
cin >> a >> b;
printf("%lld\n", ksc(a, b));
return 0;
}