mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-14 15:58:47 +00:00
18 lines
325 B
C++
18 lines
325 B
C++
|
#include <bits/stdc++.h>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
long long inv[20000005];
|
||
|
|
||
|
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;
|
||
|
}
|