Submission #10292388


Source Code Expand

// ~/Remember,remember the 6th of March

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double PI = acos(-1.0);
const double  EPS = 1e-8;
const ll MOD = 1000000007;
const int N = 100000 + 7;

ll n,a,b;
ll fastPower(ll b,ll p)
{
    if(p==0)
        return 1LL;
    ll res=fastPower(b,p/2LL);
    res%=MOD;
    res*=res;
    res%=MOD;
    if(p&1)
        res*=b;
    return (res%MOD);
}
ll binomialCoeff(ll n, ll k)
{
    ll res = 1;

    if ( k > n - k )
        k = n - k;

    for (ll i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1LL);
        res%=MOD;
    }

    return res;
}
int main()
{
    scanf("%lld%lld%lld",&n,&a,&b);
    ll ans= fastPower(2LL,n);
    ans--;
    ans=(ans%MOD+MOD)%MOD;

    ll aa= binomialCoeff(n,a)%MOD;
    ll bb= binomialCoeff(n,b)%MOD;

    ans=((ans-aa)%MOD+MOD)%MOD;
    ans=((ans-bb)%MOD+MOD)%MOD;

    printf("%lld\n",ans);
    return 0;
}



Submission Info

Submission Time
Task D - Bouquet
User Abukhadijah
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1021 Byte
Status WA
Exec Time 9 ms
Memory 256 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:43:35: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%lld%lld",&n,&a,&b);
                                   ^

Judge Result

Set Name All Sample
Score / Max Score 0 / 400 0 / 0
Status
AC × 5
WA × 17
AC × 1
WA × 1
Set Name Test Cases
All sample_01.txt, sample_02.txt, testcase_1.txt, testcase_10.txt, testcase_11.txt, testcase_12.txt, testcase_13.txt, testcase_14.txt, testcase_15.txt, testcase_16.txt, testcase_17.txt, testcase_18.txt, testcase_19.txt, testcase_2.txt, testcase_20.txt, testcase_3.txt, testcase_4.txt, testcase_5.txt, testcase_6.txt, testcase_7.txt, testcase_8.txt, testcase_9.txt
Sample sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KiB
sample_02.txt WA 8 ms 256 KiB
testcase_1.txt AC 1 ms 256 KiB
testcase_10.txt WA 5 ms 256 KiB
testcase_11.txt WA 5 ms 256 KiB
testcase_12.txt WA 5 ms 256 KiB
testcase_13.txt WA 5 ms 256 KiB
testcase_14.txt WA 3 ms 256 KiB
testcase_15.txt WA 6 ms 256 KiB
testcase_16.txt WA 4 ms 256 KiB
testcase_17.txt WA 4 ms 256 KiB
testcase_18.txt WA 5 ms 256 KiB
testcase_19.txt WA 4 ms 256 KiB
testcase_2.txt AC 1 ms 256 KiB
testcase_20.txt WA 8 ms 256 KiB
testcase_3.txt AC 1 ms 256 KiB
testcase_4.txt AC 1 ms 256 KiB
testcase_5.txt WA 9 ms 256 KiB
testcase_6.txt WA 4 ms 256 KiB
testcase_7.txt WA 4 ms 256 KiB
testcase_8.txt WA 7 ms 256 KiB
testcase_9.txt WA 3 ms 256 KiB