Submission #19822

# Submission time Handle Problem Language Result Execution time Memory
19822 2016-02-25T05:59:27 Z sujin 괄호 (kriii4_R) C++14
0 / 100
4 ms 16708 KB
#include <cstdio>

#define M 1000000007

long long a[2000001];

int main ()
{
	int n,k,i,t;
	long long s=0;

	scanf ("%d%d",&n,&k);
	a[2]=k;
	for (i=4;i<=n*2;i+=2)
	{
		if (i%4==0)
			a[i] = a[i/2];
		else
			a[i] = a[i/2-1]*k;
		a[i]+=a[i-2]*k;
		a[i]%=M;
	//	printf ("%d : %lld\n",i,a[i]);
	}

	printf ("%lld ",a[n*2]);

	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 16708 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -