Luo Gu P3811 [template] multiplicative inverse

Luo Gu P3811 [template] multiplicative inverse

Luo Gu Portal

Topic background

This is a template problem

Title Description

Given n, p 1 ~ n find all integers in the multiplicative inverse modulo p sense.

Input Format

Line n, p

Output Format

n rows, i represents the i-th row in the inverse sense modulo p.

Sample input and output

Input # 1 copy

Output # 1 copy

Description / Tips

1 \leq n \leq 3 \times 10 ^ 6, n < p < 200005281≤n≤3×106,n<p<20000528

Input to ensure the p- the p- is a prime number.


Title to its name, title templates:

About multiplicative inverse explain please poke:

On Euler's theorem and the multiplicative inverse

Code is not open long long :( See ancestors)

#define int long long
using namespace std;
const int maxn=3*1e6+10;
int n,p;
int inv[maxn];
signed main()
    for(int i=2;i<=n;i++)
    return 0;

Guess you like