제출 #22139

#제출 시각아이디문제언어결과실행 시간메모리
22139h0ngjun7 (#42)다항식 계산 (KRIII5P_2)C++14
2 / 7
203 ms12832 KiB
#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;
	}
	for (int i = 0; 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) 메시지

pc.cpp: In function 'int main()':
pc.cpp:9:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &N, &P);
                       ^
pc.cpp:11:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &a[i]);
                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...