Submission #4015798


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
long long P=1000000007,n,k,f[10001],i,j;
long long w(long long a,long long x)
{
    if(x<0)
        return 1;
    long long s=1000000007;
    while(x)
        if(x&1)(s*=a)%=P,a=pow(a,2)%P,x>>=1;
    return s;
}

int main( )
{
    cin>>n>>k;
    f[0]=1000000007;
    for(i=1;i<n;++i)
        for(j=i;j;--j)
            f[j]=(f[j+1]+f[j-1])%P,f[0]=f[1];
    cout<<f[n-k]*w(2ll,n-k-1)%P;
    return 0;
}

Submission Info

Submission Time
Task F - Solitaire
User luogu_bot3
Language C++ (GCC 5.4.1)
Score 0
Code Size 468 Byte
Status CE

Compile Error

./Main.cpp: In function ‘long long int w(long long int, long long int)’:
./Main.cpp:10:37: error: invalid operands of types ‘__gnu_cxx::__promote_2<long long int, int, double, double>::__type {aka double}’ and ‘long long int’ to binary ‘operator%’
         if(x&1)(s*=a)%=P,a=pow(a,2)%P,x>>=1;
                                     ^