Submission #19891

# Submission time Handle Problem Language Result Execution time Memory
19891 2016-02-25T06:46:45 Z inspire12 괄호 (kriii4_R) C++
0 / 100
2000 ms 8692 KB
/*
 * pro1.cpp
 *
 *  Created on: 2016. 2. 25.
 *      Author: SeoYoungHak
 */
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;
vector<pair<int, int> > v;
int dynamic(int n,int k){
	if(n==0){
		return 1;
	}
	if(n<0){
		return 0;
	}
	return k*dynamic(n-2,k)+k*dynamic(n-1,k);
}
int main()
{
	int mode = 1000000007;
	int n,k;
	scanf("%d %d",&n,&k);

	int ans = dynamic(n,k);
	printf("%d",ans%mode);
}

# Verdict Execution time Memory Grader output
1 Execution timed out 2000 ms 8692 KB Program timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -