跳到正文

fairyqq28

349241

阿巴阿巴阿巴阿巴

在洛谷打开
资料、奖项与版本

资料

编号
349241
抓取
C++
struct mod_type{
	ll p, m;
	mod_type(): mod_type(1) {}
	mod_type(const ll &x): p(x), m((1ll << 62) / x) {}
	friend ll operator % (const ll &x, const mod_type &y){
		ll ret = x-(((lll)x*y.m)>>62)*y.p;
		return ret >= y.p ? ret-y.p : ret;
	}
	friend ll& operator %= (ll &x, const mod_type &y) {return x=x%y;}
};

还没有收录这位用户的文章。