题解
2025-08-05 13:40:16
发布于:上海
31阅读
0回复
0点赞
不要暴力,别问我为什么
#include<iostream>
using namespace std;
typedef long long ll;
int main(){
    ll a,b,p;
    cin>>a>>b>>p;
    ll cheng=a,ans=1,t=b;
    while(t){
        if(t%2==1)ans*=cheng;
        ans%=p;
        cheng=cheng*cheng%p;
        t/=2;
    }
    cout<<a<<"^"<<b<<" mod "<<p<<"="<<ans;
    return 0;
}
全部评论 2
- 有点意思 - 2025-08-05 来自 上海 0
- 哥们又来发题解了[笑哭] - 2025-08-05 来自 上海 0- 那你给我点赞,我要拿题解仙人 - 2025-08-05 来自 上海 0
- 可以的 - 2025-08-05 来自 上海 0
- 你也给我点 - 2025-08-05 来自 上海 0
 






有帮助,赞一个