結果

問題 No.1756 Rider's Triangle
ユーザー koba-e964koba-e964
提出日時 2021-11-20 19:03:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 408 bytes
コンパイル時間 1,964 ms
コンパイル使用メモリ 86,868 KB
実行使用メモリ 71,408 KB
最終ジャッジ日時 2023-09-02 15:12:50
合計ジャッジ時間 5,631 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,044 KB
testcase_01 AC 76 ms
70,900 KB
testcase_02 AC 75 ms
71,308 KB
testcase_03 AC 73 ms
71,280 KB
testcase_04 AC 75 ms
71,320 KB
testcase_05 AC 75 ms
70,896 KB
testcase_06 AC 74 ms
70,912 KB
testcase_07 AC 75 ms
71,332 KB
testcase_08 AC 75 ms
71,216 KB
testcase_09 AC 75 ms
71,216 KB
testcase_10 AC 74 ms
71,172 KB
testcase_11 AC 74 ms
71,092 KB
testcase_12 AC 75 ms
71,040 KB
testcase_13 AC 75 ms
71,152 KB
testcase_14 AC 76 ms
71,376 KB
testcase_15 AC 75 ms
71,228 KB
testcase_16 AC 74 ms
71,008 KB
testcase_17 AC 74 ms
71,324 KB
testcase_18 AC 74 ms
71,380 KB
testcase_19 AC 75 ms
71,176 KB
testcase_20 AC 74 ms
71,196 KB
testcase_21 AC 74 ms
71,108 KB
testcase_22 AC 74 ms
71,092 KB
testcase_23 AC 73 ms
71,032 KB
testcase_24 AC 75 ms
70,900 KB
testcase_25 AC 75 ms
71,204 KB
testcase_26 AC 77 ms
71,220 KB
testcase_27 AC 76 ms
71,408 KB
testcase_28 AC 76 ms
71,104 KB
権限があれば一括ダウンロードができます

ソースコード

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())

if a == 0 or a == b:
    print(0)
    exit()

g = gcd(2 * a * b, b * b - a * a)
c = 2 * a * b // g
d = (b * b - a * a) // g


tot = 0

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

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

print(tot % 998244353)
0