Submission #22181

#TimeUsernameProblemLanguageResultExecution timeMemory
22181sdfgsfg (#42)다항식 계산 (KRIII5P_2)C++11
0 / 7
0 ms5928 KiB
#include <iostream> #include <vector> using namespace std; int main() { int n, p; cin >> n >> p; vector<int> a(1000000); for (int i = 0; i < n+1; i++) { int temp; cin >> temp; a[n-i] = temp; } int res = 0; int pow = 1; for (int i = 0; i < p; i++) { for (int j = 1; j < n+1; j++) { pow *= i; pow %= p; res += (pow * a[j] % p); res %= p; } cout << (res+a[0])%p << endl; res = 0; pow = 1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...