| 比赛 | 2020级再出发之二进制拆分及运用 | 评测结果 | AAAAA |
|---|---|---|---|
| 题目名称 | 64位整数乘法 | 最终得分 | 100 |
| 用户昵称 | ┭┮﹏┭┮ | 运行时间 | 0.000 s |
| 代码语言 | C++ | 内存使用 | 0.00 MiB |
| 提交时间 | 2023-07-24 12:37:43 | ||
#include <bits/stdc++.h>
using namespace std;
long long a,b,p,ans = 0;
int main(){
freopen("64mul.in","r",stdin);
freopen("64mul.out","w",stdout);
scanf("%lld%lld%lld",&a,&b,&p);
while(b){
if(b & 1)ans = (ans + a) % p;
a = (a << 1) % p;
b >>= 1;
}
printf("%lld\n",ans);
return 0;
}