O(N)求1~N逆元

2019-04-14 08:26发布

ll inv[N]; void init(){ inv[1] = inv[0] = 1; for(int i = 2;i < N;i++) inv[i] = inv[mod%i]*(mod-mod/i)%mod; }