Submission #22093

#TimeUsernameProblemLanguageResultExecution timeMemory
22093쀼쀼~ (#42)다항식 계산 (KRIII5P_2)C++11
7 / 7
243 ms2024 KiB
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <memory.h> #include <math.h> #include <assert.h> #include <queue> #include <map> #include <set> #include <string> #include <algorithm> #include <iostream> #include <functional> #include <unordered_map> #include <unordered_set> #include <list> #include <bitset> using namespace std; typedef pair<int, int> Pi; typedef long long ll; #define pii Pi #define pll PL #define Fi first #define Se second #define pb(x) push_back(x) #define sz(x) ((int)(x).size()) #define rep(i, n) for(int i=0;i<n;i++) #define all(x) (x).begin(), (x).end() typedef tuple<int, int, int> t3; typedef pair<ll, ll> PL; typedef long double ldouble; int N, P, A[1010]; void solve(){ scanf("%d%d", &N, &P); for(int i=N;i>=0;i--){ int x; scanf("%d", &x); int j = i % (P - 1); A[j] = (A[j] + x) % P; if(i == 0)printf("%d\n", x % P); } for(int i=1;i<P;i++){ int c = 0, t = 1; for(int j=0;j<P-1;j++){ c = (c + (ll)t * A[j]) % P; t = (ll)t * i % P; } printf("%d\n", c); } } int main(){ int Tc = 1; //scanf("%d\n", &Tc); for(int tc=1;tc<=Tc;tc++){ solve(); } return 0; }

Compilation message (stderr)

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