Submission #19933

# Submission time Handle Problem Language Result Execution time Memory
19933 2016-02-25T07:24:09 Z sujin 괄호 (kriii4_R) C++14
0 / 100
7 ms 32332 KB
#include <cstdio>

#define M 1000000007

long long a[2000001][2];

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

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

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