From 162d089d41014752f736d7933dc35f96171f56e9 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Thu, 5 Nov 2020 20:57:12 +0800 Subject: [PATCH] =?UTF-8?q?P3811=20=E3=80=90=E6=A8=A1=E6=9D=BF=E3=80=91?= =?UTF-8?q?=E4=B9=98=E6=B3=95=E9=80=86=E5=85=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R41337330 --- problem/P3811/P3811.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 problem/P3811/P3811.cpp diff --git a/problem/P3811/P3811.cpp b/problem/P3811/P3811.cpp new file mode 100644 index 00000000..3a1f1266 --- /dev/null +++ b/problem/P3811/P3811.cpp @@ -0,0 +1,18 @@ +#include + +using namespace std; + +long long inv[3000005]; + +int main() { + inv[0] = 0; + inv[1] = 1; + int n, p; + scanf("%d%d", &n, &p); + printf("1\n"); + for (int i = 2; i <= n; ++i) { + inv[i] = (long long)p - (p / i) * inv[p % i] % p; + printf("%d\n", inv[i]); + } + return 0; +}