結果

問題 No.895 MESE
ユーザー alorie10alorie10
提出日時 2019-09-27 23:01:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 791 bytes
コンパイル時間 555 ms
コンパイル使用メモリ 65,208 KB
実行使用メモリ 10,652 KB
最終ジャッジ日時 2023-10-25 05:39:47
合計ジャッジ時間 5,273 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,720 KB
testcase_01 AC 2 ms
7,720 KB
testcase_02 WA -
testcase_03 AC 3 ms
7,720 KB
testcase_04 AC 2 ms
7,720 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
typedef long long ll;
ll n,a,b,c,s,ans,MOD=1e9+7,bi[300001],bi5[300001],L,w[300001];
ll f(ll x,ll y){
    if(y==0)return 1;
    if(y%2==0)return f(x,y/2)*f(x,y/2)%MOD;
    return x*f(x,y-1)%MOD;
}
ll comb(ll x,ll y){
    return bi[x]*bi5[x-y]%MOD*bi5[y]%MOD;
}
int main(void){
    cin>>a>>b>>c;
    s=a+b+c;
    bi[0]=1;
    bi5[0]=1;
    w[0]=1;
    for(int i=1;i<=s;i++){
        w[i]=w[i-1]*2%MOD;
        bi[i]=bi[i-1]*i%MOD;;
        bi5[i]=f(bi[i],1e9+5);
    }
    for(int i=2;i<=s-c;i++){
        L=comb(s-c-1,b);
        if(s-i-c>=b)L-=comb(s-i-c,b);
        L*=w[s-i-1]%MOD;
        if(c>1)L*=w[s-i-2]*(c-1)%MOD;
        ans+=L;
        ans%=MOD;
    }
    cout<<(ans+MOD)%MOD<<endl;
    //cout<<comb(7,2)<<endl;
    //cout<<w[10]<<endl;
}
0