Submission #19842

# Submission time Handle Problem Language Result Execution time Memory
19842 2016-02-25T06:10:49 Z willbelucky 괄호 (kriii4_R) C++
0 / 100
0 ms 1716 KB
#include <iostream>
using namespace std;

int main()
{
	int N, K;
	cin >> N >> K;

	int cache[4];
	cache[0] = 1;
	cache[1] = K;

	for (int iter = 2; iter < N+1; iter++)
		cache[iter & 3] = (cache[(iter - 2) & 3] + cache[(iter - 1) & 3]) * K;

	cout << cache[N & 3] % 1000000007 << endl;

	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1716 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -