mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 19:08:47 +00:00
parent
af5bf736f8
commit
e93b52517e
@ -1,18 +1,29 @@
|
||||
#include <bits/stdc++.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
long long inv[3000005];
|
||||
const int N = 3e6 + 5;
|
||||
|
||||
int n, p, inv[N];
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n >> p;
|
||||
|
||||
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]);
|
||||
|
||||
cout << inv[1] << endl;
|
||||
|
||||
for (int i = 2; i <= n; i++) {
|
||||
inv[i] = p - static_cast<long long>(p) / i * inv[p % i] % p;
|
||||
|
||||
cout << inv[i] << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
BIN
Luogu/P3811/data/P3811_3.in
(Stored with Git LFS)
Normal file
BIN
Luogu/P3811/data/P3811_3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Luogu/P3811/data/P3811_3.out
(Stored with Git LFS)
Normal file
BIN
Luogu/P3811/data/P3811_3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user