Submission #20122

# Submission time Handle Problem Language Result Execution time Memory
20122 2016-02-26T06:25:44 Z sys7961 괄호 (kriii4_R) C++14
0 / 100
15 ms 8904 KB
#include<stdio.h>

long long dy[1001000];
long long m = 1000000007;

int main() {
	long long n, k;
	scanf("%lld%lld", &n, &k);
	dy[0] = 1;
	long long sum = 0;
	long long p = 0;
	for (int i = 0; i < n; i++) {
		dy[i + 1] = (dy[i] * k)%m;
		p += sum;
		p %= m;
		dy[i + 1] += p;
		dy[i + 1] % m;
		sum += dy[i + 1];
		sum %= m;
	}
	printf("%lld", dy[n]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 8904 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -