# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
22144 | h0ngjun7 (#42) | 다항식 계산 (KRIII5P_2) | C++14 | 263 ms | 12832 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <vector>
using namespace std;
const int MAXN = 1000005;
typedef long long ll;
int N, P, a[MAXN];
ll s[MAXN];
int main() {
scanf("%d%d", &N, &P);
for (int i = N; i >= 0; i--) {
scanf("%d", &a[i]);
a[i] %= P;
s[i % (P - 1)] += a[i];
s[i % (P - 1)] %= P;
}
printf("%d\n", a[0]);
for (int i = 1; i < P; i++) {
ll g = 1, ans = 0;
for (int j = 0; j < P; j++) {
ans = (ans + g * s[j]) % P;
g = (g*i) % P;
}
printf("%lld\n", ans);
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |