結果
| 問題 |
No.1662 (ox) Alternative
|
| コンテスト | |
| ユーザー |
ytft
|
| 提出日時 | 2021-08-31 10:05:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 874 bytes |
| コンパイル時間 | 4,626 ms |
| コンパイル使用メモリ | 336,820 KB |
| 実行使用メモリ | 13,636 KB |
| 最終ジャッジ日時 | 2024-11-25 03:00:43 |
| 合計ジャッジ時間 | 11,507 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 1 TLE * 2 |
ソースコード
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
namespace mp = boost::multiprecision;
int main(){
int T;
cin>>T;
for(int j=0;j<T;++j){
int A,B,C,D;
cin>>A>>B>>C>>D;
if(A!=B){
cout<<0<<endl;
continue;
}
int mod=1e9+7;
long long a=1,b=A;
for(int i=1;i<A;++i){
a=(a*(D+i))%mod;
b=(b*i)%mod;
a=(a*(A+D+1+i))%mod;
b=(b*i)%mod;
}
for(int i=1;i<=C;++i){
a=(a*(A+B+D+i))%mod;
b=(b*i)%mod;
}
int counter=mod-2;
int ans=1;
while(counter){
if(counter%2){
ans=(ans*b)%mod;
}
b=(b*b)%mod;
counter/=2;
}
ans=(ans*a)%mod;
cout<<ans<<endl;
}
}
ytft