Submission #3401249


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
long long p=1000000007ll;
long long n,k,dp[10001];
long long quickpow(long long a,long long b)
{
	if(b<0) return 1;
	if(b==0&&n>1) return 1;
	if(b==0&&n==1) return 0;
	if(b==1) return a%p;
	if(b%2==0)
	{
		long long t=quickpow(a,b/2);
		return t*t%p;
	}
	else
	{
		long long t=quickpow(a,b/2);
		t=t*t%p;
		return t*a%p;
	}
}

int main(){
    cin>>n>>k;
    dp[0]=1;
    for(int i=1;i<n;i++)
	{
		for(int j=i;j>0;j--)
			dp[j]=(dp[j+1]+dp[j-1])%p;
		dp[0]=dp[1];
	}
	cout<<(long long)(dp[n-k]*quickpow(2,n-k-1)%p)<<endl;
}

Submission Info

Submission Time
Task F - Solitaire
User luogu_bot5
Language C++ (GCC 5.4.1)
Score 1200
Code Size 600 Byte
Status AC
Exec Time 32 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 1200 / 1200
Status
AC × 3
AC × 26
Set Name Test Cases
Sample 00_example_01.txt, 00_example_02.txt, 00_example_03.txt
All 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt
Case Name Status Exec Time Memory
00_example_01.txt AC 1 ms 256 KB
00_example_02.txt AC 1 ms 256 KB
00_example_03.txt AC 32 ms 256 KB
01.txt AC 1 ms 256 KB
02.txt AC 10 ms 256 KB
03.txt AC 1 ms 256 KB
04.txt AC 1 ms 256 KB
05.txt AC 1 ms 256 KB
06.txt AC 1 ms 256 KB
07.txt AC 1 ms 256 KB
08.txt AC 1 ms 256 KB
09.txt AC 29 ms 256 KB
10.txt AC 1 ms 256 KB
11.txt AC 1 ms 256 KB
12.txt AC 28 ms 256 KB
13.txt AC 1 ms 256 KB
14.txt AC 31 ms 256 KB
15.txt AC 3 ms 256 KB
16.txt AC 32 ms 256 KB
17.txt AC 32 ms 256 KB
18.txt AC 32 ms 256 KB
19.txt AC 32 ms 256 KB
20.txt AC 32 ms 256 KB
21.txt AC 1 ms 256 KB
22.txt AC 32 ms 256 KB
23.txt AC 32 ms 256 KB