結果
| 問題 |
No.1756 Rider's Triangle
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-20 19:03:06 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 406 bytes |
| コンパイル時間 | 545 ms |
| コンパイル使用メモリ | 82,360 KB |
| 実行使用メモリ | 66,452 KB |
| 最終ジャッジ日時 | 2024-06-11 21:47:14 |
| 合計ジャッジ時間 | 2,405 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 RE * 1 |
| 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())
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 = 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)