結果
| 問題 |
No.1662 (ox) Alternative
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-12 15:56:17 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 734 bytes |
| コンパイル時間 | 2,363 ms |
| コンパイル使用メモリ | 192,436 KB |
| 実行使用メモリ | 8,524 KB |
| 最終ジャッジ日時 | 2025-01-12 15:56:21 |
| 合計ジャッジ時間 | 3,570 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 WA * 1 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:24:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
24 | scanf("%d", &cases);
| ~~~~~^~~~~~~~~~~~~~
main.cpp:28:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
28 | scanf("%d%d%d%d", &a, &b, &c, &d);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using LL = long long;
const int N = 4e5 + 7;
const int MOD = 1e9 + 7;
int fac[N], ifc[N], inv[N];
int com(int x, int y) {
return 1LL * fac[x] * ifc[y] % MOD * ifc[x - y] % MOD;
}
int main() {
fac[0] = ifc[0] = fac[1] = ifc[1] = inv[1] = 1;
for(int i = 2; i < N; ++i) {
fac[i] = 1LL * fac[i - 1] * i % MOD;
inv[i] = MOD - 1LL * (MOD / i) * inv[MOD % i] % MOD;
ifc[i] = 1LL * ifc[i - 1] * inv[i] % MOD;
}
int cases;
scanf("%d", &cases);
while(cases--) {
int a, b, c, d;
scanf("%d%d%d%d", &a, &b, &c, &d);
printf("%lld\n", a != b ? 0LL : 1LL * inv[a] * com(a + b + c + d, c) % MOD *
com(a + d - 1, d) % MOD * com(2 * a + d, a - 1) % MOD);
}
return 0;
}