結果

問題 No.1756 Rider's Triangle
ユーザー koba-e964koba-e964
提出日時 2021-11-20 18:34:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 537 bytes
コンパイル時間 305 ms
コンパイル使用メモリ 86,916 KB
実行使用メモリ 78,860 KB
最終ジャッジ日時 2023-09-02 14:35:33
合計ジャッジ時間 4,386 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 70 ms
71,280 KB
testcase_02 RE -
testcase_03 WA -
testcase_04 AC 70 ms
71,180 KB
testcase_05 AC 72 ms
71,308 KB
testcase_06 AC 71 ms
71,296 KB
testcase_07 AC 71 ms
71,216 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

def gcd(x, y):
    while y != 0:
        r = x % y
        x = y
        y = r
    return x


a, b, n = map(int, input().split())
g = gcd(2 * a * b, b * b - a * a)
c = 2 * a * b // g
d = (b * b - a * a) // g

if c == 0 or d == 0:
    print(0)
    exit()

tot = 0

x = a * c - b * d
y = a * d + b * c
x = a * c - max(x, 0)

if x < n and y < n:
    tot += (n - x) * (n - y) * 4

x = b * c - a * d
y = b * d + a * c
x = b * c - min(x, 0)

if x < n and y < n:
    tot += (n - x) * (n - y) * 4

print(tot % 998244353)
0