結果

問題 No.61 リベリオン
ユーザー H3PO4H3PO4
提出日時 2020-04-23 10:56:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 526 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-04-21 09:10:40
合計ジャッジ時間 1,700 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
10,752 KB
testcase_01 AC 34 ms
10,752 KB
testcase_02 AC 38 ms
10,624 KB
testcase_03 AC 438 ms
10,624 KB
testcase_04 AC 426 ms
10,752 KB
testcase_05 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from math import gcd

input = sys.stdin.readline

Q = int(input())
for _ in range(Q):
    W, H, D, Mx, My, Hx, Hy, Vx, Vy = map(int, input().split())
    g = gcd(Vx, Vy)
    Ux, Uy = Vx // g, Vy // g
    X, Y = Hx + Ux, Hy + Uy
    ct = 1
    while not (X % (2 * W) == Hx and Y % (2 * H) == Hy) and ct // g < D:
        if X % (2 * W) in {Mx, 2 * W - Mx} and Y % (2 * H) in {My, 2 * H - My}:
            print('Hit')
            break
        X += Ux
        Y += Uy
        ct += 1
    else:
        print('Miss')
0