Submission #19719

# Submission time Handle Problem Language Result Execution time Memory
19719 2016-02-25T04:57:04 Z kk1401 괄호 (kriii4_R) C++
0 / 100
0 ms 8896 KB
#include<stdio.h>
#define M 1000000007ll

int n;
long long d[1000001],k;

int main()
{
	int i;
	
	scanf("%d%lld",&n,&k);
	
	d[1] = k;
	
	for(i=2; i<=n; i++){
		if(i%2 == 0) d[i] = (d[i-1] * (k + 1ll)) % M;
		else d[i] = ((d[i-1] * k) % M + (d[i-1] - d[(i-1)/2] + M) % M) % M;
	}
	
	printf("%lld\n",d[n]);
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 8896 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -