Submission #22091

#TimeUsernameProblemLanguageResultExecution timeMemory
22091삼*전자 그린픽스 (#42)다항식 계산 (KRIII5P_2)C++98
7 / 7
249 ms8936 KiB
#include<stdio.h> int n, m; long long int a[1000009]; long long int d[1009]; int main() { int i, j, k, l; scanf("%d %d", &n, &m); for (i = 0; i <= n; i++) { scanf("%lld", &a[n-i]); } printf("%lld\n", a[0]%m); for (i = 0; i <= n; i++) { d[i % (m - 1)] = (d[i % (m - 1)]+a[i])%m; } for (i = 1; i < m; i++) { long long int j = 1; long long int res = 0; for (k = 0; k < m-1; k++) { res = (res + j * d[k]) % m; j = (j*i) % m; } printf("%lld\n", res); } return 0; }

Compilation message (stderr)

pc.cpp: In function 'int main()':
pc.cpp:6:9: warning: unused variable 'j' [-Wunused-variable]
  int i, j, k, l;
         ^
pc.cpp:6:15: warning: unused variable 'l' [-Wunused-variable]
  int i, j, k, l;
               ^
pc.cpp:7:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &m);
                        ^
pc.cpp:9:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &a[n-i]);
                         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...