답안 #22222

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
22222 2017-04-30T02:21:49 Z 현재PC방은도타2가점령!!(#1002, exqt) 다항식 계산 (KRIII5P_2) C++
0 / 7
0 ms 2020 KB
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <utility>
#include <string>
#include <set>
#include <map>
using namespace std;

int main()
{
	// freopen("in.txt", "r+", stdin);
	// freopen("out.txt", "w+", stdout);

	int n, p; cin >> n >> p;
	vector<int> a(n+1);
	for(int i=n; i>=0; i--) cin >> a[i];

	for(int i=p-1; i<=n; i++)
	{
		a[i%(p-1)] = (a[i%(p-1)] + a[i]) % p;
	}

	for(int i=0; i<p; i++)
	{
		int r = 0;
		int t = 1;
		for(int j=0; j<=p-1; j++)
		{
			r = (r + 1LL * t * a[j]) % p; 
			t = (t * i) % p;
		}

		cout << r << endl;
	}

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 0 ms 2020 KB Output is correct
3 Correct 0 ms 2020 KB Output is correct
4 Incorrect 0 ms 2020 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 0 ms 2020 KB Output is correct
3 Correct 0 ms 2020 KB Output is correct
4 Incorrect 0 ms 2020 KB Output isn't correct
5 Halted 0 ms 0 KB -