제출 #22165

#제출 시각아이디문제언어결과실행 시간메모리
22165스팟보드CSS가깨져요 (#42)다항식 계산 (KRIII5P_2)C++98
2 / 7
183 ms1124 KiB
#include<stdio.h>

int N, P, ba[2222];

int main(){
	scanf("%d%d", &N, &P);
	for(int i=N; i>=0; i--){
		int a, i2 = i%(P-1);
		scanf("%d", &a);
		if(i2 == 0 && i != 0)i2 = P-1;
		ba[i2] += a;
	}
	for(int i=0; i<P; i++)ba[i] %= P;
	for(int i=0; i<P; i++){
		int sum=0, jg=1;
		for(int j=0; j<P; j++){
			sum += jg*ba[j]; sum %= P;
			jg *= i; jg %= P;
		}
		printf("%d\n", sum);
	}
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

pc.cpp: In function 'int main()':
pc.cpp:6: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:9:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &a);
                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...