比赛 位运算及及其应用题单 评测结果 WWWWW
题目名称 64位整数乘法 最终得分 0
用户昵称 秋_Water 运行时间 0.014 s
代码语言 C++ 内存使用 3.33 MiB
提交时间 2025-01-25 11:55:44
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
long long a,b,p;
int main(){
    freopen("64mul.in","r",stdin);
    freopen("64mul.out","w",stdout);     
    cin>>a>>b>>p;
    long long ans=1;
    while(b){
        if(b&1){
            ans=ans*a%p;
        }
        a=a*a%p;
        b=b>>1;
    }
    cout<<ans;

    return 0;
}