結果
| 問題 |
No.1756 Rider's Triangle
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-20 19:03:42 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 2,000 ms |
| コード長 | 408 bytes |
| コンパイル時間 | 296 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 52,352 KB |
| 最終ジャッジ日時 | 2024-06-11 21:48:01 |
| 合計ジャッジ時間 | 2,310 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 25 |
ソースコード
#!/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)