比赛 | 位运算及及其应用题单 | 评测结果 | AAAAA |
---|---|---|---|
题目名称 | 64位整数乘法 | 最终得分 | 100 |
用户昵称 | 李金泽 | 运行时间 | 0.009 s |
代码语言 | C++ | 内存使用 | 1.48 MiB |
提交时间 | 2025-01-25 11:16:20 | ||
#include<cstdio> #define ll long long using namespace std; ll a,b,p; ll fp() { ll ans=0; while(b) { if(b&1)ans=(ans+a)%p; a=2*a%p; b>>=1; } return ans; } int main(){ freopen("64mul.in","r",stdin);freopen("64mul.out","w",stdout); scanf("%lld%lld%lld",&a,&b,&p); printf("%lld",fp()); return 0; }