new file: P3811.cpp
Check cpp / md pair / Check md headers (push) Successful in 4s

This commit is contained in:
hanyixuanten committed 2026-10-28 13:13:01 +00:00
1 parent c89b0d349f
commit 8c1dfb5d0c
2 files changed
+84

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
# 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 $ 为质数。