Submission #22204

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

Compilation message (stderr)

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