Submission #22092

# Submission time Handle Problem Language Result Execution time Memory
22092 2017-04-29T07:59:05 Z 쀼쀼~(#1017, cki86201) None (KRIII5P_2) C++11
0 / 7
0 ms 2024 KB
#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);
	}
	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

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 time Memory Grader output
1 Incorrect 0 ms 2024 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2024 KB Output isn't correct
2 Halted 0 ms 0 KB -