結果
| 問題 | No.3682 きあいのハチマキ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-05 14:37:14 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 34 ms / 2,000 ms |
| + 625µs | |
| コード長 | 1,034 bytes |
| 記録 | |
| コンパイル時間 | 1,866 ms |
| コンパイル使用メモリ | 338,588 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-09-05 14:37:18 |
| 合計ジャッジ時間 | 3,076 ms |
|
ジャッジサーバーID (参考情報) |
judge5_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 |
ソースコード
#include <atcoder/modint>
#include <bits/stdc++.h>
using mint = atcoder::modint998244353;
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int t;
cin >> t;
while (t--) {
ll hc, ac, sc, hg, ag, sg;
cin >> hc >> ac >> sc >> hg >> ag >> sg;
ll c = (hc - 1) / ag;
ll g = (hg - 1) / ac;
mint ans = 0;
if (sc == sg) {
mint r = 0;
if (c > g) {
ans += 1 - mint(10).inv().pow(c - g);
}
r = mint(10).inv().pow(abs(c - g));
ans += r / 2;
} else {
if (sc < sg) {
g++;
}
mint r = 0;
if (c > g) {
ans += 1 - mint(10).inv().pow(c - g);
}
r = mint(10).inv().pow(abs(c - g));
ans += r * mint(10) / 11;
}
cout << ans.val() << endl;
}
return 0;
}