Submission #19720

# Submission time Handle Problem Language Result Execution time Memory
19720 2016-02-25T04:57:40 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 % 1000000007);
	}

	cout << cache[N&3] << endl;
}
# 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 -