跳到正文

个人记录

mul

Na2C2O4约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年3月31日
篇幅
约 1 分钟

版本

  1. v1当前

理论上在 O(1)O(1) 情况下的快速 ×\times

C++
#define int long long
#define ull unsigned long long
int mul(int a,int b,int p){
	ull c=(ull)a*b-(ull)((long double)a/p*b+0.5L)*p;
	return c<p?c:c+p;
}
原文