#G. 【模板】模意义下的乘法逆元

    Type: RemoteJudge 500ms 125MiB

【模板】模意义下的乘法逆元

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目背景

这是一道模板题

题目描述

给定 n,pn,p1n1\sim n 中所有整数在模 pp 意义下的乘法逆元。

这里 aapp 的乘法逆元定义为 ax1(modp)ax\equiv1\pmod p 的解。

输入格式

一行两个正整数 n,pn,p

输出格式

输出 nn 行,第 ii 行表示 ii 在模 pp 下的乘法逆元。

10 13
1
7
9
10
8
11
2
5
3
4

提示

1n3×106 1 \leq n \leq 3 \times 10 ^ 6n<p<20000528n < p < 20000528

输入保证 p p 为质数。

模板训练2

Not Attended
Status
Done
Rule
IOI
Problem
8
Start at
2025-7-7 8:45
End at
2025-7-9 0:45
Duration
40 hour(s)
Host
Partic.
21