Submission #20013

# Submission time Handle Problem Language Result Execution time Memory
20013 2016-02-25T08:29:28 Z suzy 괄호 (kriii4_R) C++
0 / 100
6 ms 14328 KB
#include <cstdio>
#include <cstring>
using namespace std;
const int MOD = 1000000007;

int dp[1000000], N, K;

int paren(int pos){
	if(pos == N) return 1;
	int &ret = dp[pos];
	if(ret != -1) return ret;
	ret = paren(pos+1);
	if(pos < N-1) ret += paren(pos+2);
	return ret = 1LL*K*ret % MOD;
}

int main(){
	scanf("%d %d", &N, &K);
	memset(dp, -1, sizeof(dp));
	printf("%d\n", paren(0));
}
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 14328 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -