Submission #19775

# Submission time Handle Problem Language Result Execution time Memory
19775 2016-02-25T05:29:18 Z willbelucky 괄호 (kriii4_R) C++
0 / 100
3 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 % 1000000007);
	}

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

	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 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 -