首页 > 其他分享 >90. 64位整数乘法

90. 64位整数乘法

时间:2023-02-13 19:44:48浏览次数:40  
标签:ll cin long 64 ans 90 乘法

 

点击查看代码
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const int N = 1e6 + 10;
ll a,b,p;
ll solve()
{
	ll ans=0;
	while(b)
	{
		if(b&1)
		ans=(ans+a)%p;
		b=b>>1;
		a=(a<<1)%p;
	}
	return ans%p;
}
int main() {
	cin.tie(nullptr)->sync_with_stdio(false);
	cin>>a>>b;
	cin>>p;
	cout<<solve()<<endl;
	return 0 ^ 0;
}

标签:ll,cin,long,64,ans,90,乘法
From: https://www.cnblogs.com/xxj112/p/17117560.html

相关文章