#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;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
5928 KB |
Output is correct |
2 |
Correct |
0 ms |
5928 KB |
Output is correct |
3 |
Incorrect |
0 ms |
5928 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
5928 KB |
Output is correct |
2 |
Correct |
0 ms |
5928 KB |
Output is correct |
3 |
Incorrect |
0 ms |
5928 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |