結果

問題 No.3682 きあいのハチマキ
コンテスト
ユーザー Prala
提出日時 2026-09-05 15:11:56
言語 PyPy3
(7.3.23)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 1,755 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 224 ms
コンパイル使用メモリ 95,696 KB
実行使用メモリ 88,220 KB
最終ジャッジ日時 2026-09-05 15:12:04
合計ジャッジ時間 2,584 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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 = (2*(pow(10, point, mod)))%mod
        if point > 0:
            print(mod_div(ans-1, ans, mod))
        else:
            print(mod_inv(ans, mod))
0