Files
luogu/P3811.md
T
hanyixuanten 8c1dfb5d0c
Check cpp / md pair / Check md headers (push) Successful in 4s
new file: P3811.cpp
2026-10-28 13:13:01 +00:00

48 lines
641 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# P3811 【模板】模意义下的乘法逆元
## 题目背景
这是一道模板题。
## 题目描述
给定正整数 $n,p$,求 $[1,n]$ 中所有整数在模 $p$ 意义下的乘法逆元。
$a$ 模 $p$ 的乘法逆元定义为 $ax\equiv1\pmod p$ 的解。
## 输入格式
一行两个正整数 $n,p$。
## 输出格式
输出 $n$ 行,其中第 $i$ 行表示 $i$ 在模 $p$ 下的乘法逆元。
## 输入输出样例 #1
### 输入 #1
```
10 13
```
### 输出 #1
```
1
7
9
10
8
11
2
5
3
4
```
## 说明/提示
所有数据满足 $ 1 \leq n \leq 3 \times 10 ^ 6$,$n < p < 20000528 $。
输入保证 $ p $ 为质数。