|
Download benchmarks/Algorithms/linear_modular_inverse/problem.md from PV-SJTU/PV-Bench: direct link, hf CLI and curl.
- Browser
- Download file 673 Bytes
-
https://huggingface.co/datasets/PV-SJTU/PV-Bench/resolve/main/benchmarks/Algorithms/linear_modular_inverse/problem.md
- Command line
-
hf download hf://datasets/PV-SJTU/PV-Bench/benchmarks/Algorithms/linear_modular_inverse/problem.md
-
curl -L -o problem.md https://huggingface.co/datasets/PV-SJTU/PV-Bench/resolve/main/benchmarks/Algorithms/linear_modular_inverse/problem.md
673 Bytes
P3811 — Multiplicative Inverses Modulo a Prime
Description
Given positive integers $n$ and $p$, find the multiplicative inverse modulo $p$ of every integer in $[1,n]$.
An integer $x$ is a multiplicative inverse of $a$ modulo $p$ if
The input guarantees that $p$ is prime.
Input
The only line contains two positive integers $n$ and $p$.
Output
Print $n$ lines. The $i$-th line contains the multiplicative inverse of $i$ modulo $p$.
Constraints
- $1 \le n \le 3\times10^6$.
- $n < p < 20000528$.
- $p$ is prime.