#include <iostream> using namespace std; int main() { long long a, b, p; cin >> a >> b >> p; long long res = 0; while(b) { if(b & 1) res = (res + a) % p; a = (a + a) % p; b >>= 1; } cout << res << endl; return 0; }
原文地址:https://www.cnblogs.com/mjn1/p/11708641.html
时间: 2024-10-15 03:16:47