打卡记录
#include <iostream> using namespace std; int main() { long long a, b, p, ans; cin >> a >> b >> p; for( ; b; b>>=1) { if(b & 1) ans = (ans + a) % p; a = a * 2 % p; } cout << ans << endl; }