Submission #22223

# Submission time Handle Problem Language Result Execution time Memory
22223 2017-04-30T02:22:20 Z a(#1038, wimzzang) None (KRIII5P_2) C++
0 / 7
0 ms 2020 KB
#include <iostream>
#include <stdio.h>
#include <vector>

using namespace std;

int P;
int fMOD_P(const vector<int> &a, const int x) {
	int xPow = 1;
	int fx = 0;
	for (int i = 0; i < a.size(); i++) {
		fx = (fx + a[i] * xPow) % P;
		xPow = (xPow*x) % P;
	}
	return fx;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	//setbuf(stdout, NULL);
	int testCase; cin >> testCase;
	for (int t = 1; t <= testCase; t++)
	{
		int N; cin >> N >> P;
		vector<int> a(N+1);
		for (int i = N; i >= 0; i--) {
			cin >> a[i];
			a[i] = a[i] % P;
		}
		cout << "testCase" << t << endl;
		for (int i = 0; i < P; i++)
			cout << fMOD_P(a, i) << endl;

	}
	return 0;
}

Compilation message

pc.cpp: In function 'int fMOD_P(const std::vector<int>&, int)':
pc.cpp:11:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < a.size(); i++) {
                    ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2020 KB Output isn't correct
2 Halted 0 ms 0 KB -