結果
| 問題 | No.3682 きあいのハチマキ |
| コンテスト | |
| ユーザー |
Prala
|
| 提出日時 | 2026-09-05 15:09:36 |
| 言語 | PyPy3 (7.3.23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,777 bytes |
| 記録 | |
| コンパイル時間 | 239 ms |
| コンパイル使用メモリ | 95,944 KB |
| 実行使用メモリ | 89,112 KB |
| 最終ジャッジ日時 | 2026-09-05 15:09:40 |
| 合計ジャッジ時間 | 2,199 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 2 |
ソースコード
import sys
import math
import bisect
import heapq
from collections import deque, defaultdict
#160427717982164055zq
# -------------------------------------------------
def ST(): return input().rstrip()
def IN(): return int(input())
def ML(typ=int): return [typ(x) for x in input().split()]
def IM(): return ML()
def IL(): return ML()
mod = 998244353
def mod_inv(a, mod):
return pow(a, mod-2, mod)
def mod_div(x, y, mod):
inv = mod_inv(y, mod)
return (x*inv)%mod
T = IN()
# 岩井星人さん、ポケモンだったらしい。
def updiv(a, b):
return a//b if not a%b else a//b+1
for i in range(T):
a, b, c, d, e, f = IM()
# 何回の攻撃でHPを0にされるか
c_cy = updiv(a, e)
c_gr = updiv(d, b)
# すばやさが引き分けじゃない場合を考える。
if c != f:
# 水色コーダー側が何回分有利か
point = 0
if c_cy == c_gr:
if c > f:
point = 1
else:
point = -1
else:
point = c_cy - c_gr
if point > 0 and c > f:
point += 1
if point < 0 and c < f:
point -= 1
print(point, file=sys.stderr)
ans = 11*pow(10, abs(point)-1, mod)
ans %= mod
if point > 0:
print(mod_div(ans-1, ans, mod))
else:
print(mod_inv(ans, mod))
if c == f:
if c_cy == c_gr:
print(499122177)
continue
point = c_cy-c_gr
# 不利な側は、実質1/10の確率で一方的に1減らせる
ans = (499122177*(pow(mod_inv(10, mod), point, mod)))%mod
if point > 0:
print(mod_div(ans-1, ans, mod))
else:
print(mod_inv(ans, mod))
Prala