Submission #19712

# Submission time Handle Problem Language Result Execution time Memory
19712 2016-02-25T04:52:07 Z jeapi 괄호 (kriii4_R) C++
0 / 100
0 ms 9528 KB
#include<iostream>
using namespace std;
typedef long long ll;
ll D[1000001];
int main() {
	ll N, K;
	cin >> N >> K;
	D[1] = K;
	for (int i = 2; i <= N; i++) {
		if (i % 2 == 0) {
			D[i] = (D[i - 1] + (D[i - 1] * K))%1000000007;
		}
		else
		{
			D[i] = (D[i - 1] * K)% 1000000007;
		}
	}
	cout << D[N] << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 9528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -