Submission #19823

# Submission time Handle Problem Language Result Execution time Memory
19823 2016-02-25T05:59:46 Z kk1401 괄호 (kriii4_R) C++
0 / 100
4 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+1) - d[(i-1)/2] + M) % M;
	}
	
	printf("%lld\n",d[n]);
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 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 -