Submission #22165

#TimeUsernameProblemLanguageResultExecution timeMemory
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; }

Compilation message (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...