Submission #22203

#TimeUsernameProblemLanguageResultExecution timeMemory
22203새벽 2시 22분 (#42)다항식 계산 (KRIII5P_2)C++14
0 / 7
0 ms5032 KiB
#include<stdio.h> int n,p,a[1001],b[1001][1001],last; int main() { scanf("%d%d",&n,&p); for(int i=n,x;i>=0;i--) { scanf("%d",&x); a[i%(p-1)] += x; last = x; } for(int i=0;i<p;i++) { b[i][0] = 1; for(int j=1;j<p;j++) b[i][j] = b[i][j-1] * i % p; } printf("%d\n", last % p); for(int i=1;i<p;i++) { int res = 0; for(int j=0;j<p;j++) res = (res + a[j] * b[i][j]) % p; printf("%d\n", res); } return 0; }

Compilation message (stderr)

pc.cpp: In function 'int main()':
pc.cpp:4:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&p);
                        ^
pc.cpp:6:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&x);
                       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...