結果
問題 |
No.2953 Maximum Right Triangle
|
ユーザー |
![]() |
提出日時 | 2024-11-08 21:53:58 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 585 bytes |
コンパイル時間 | 185 ms |
コンパイル使用メモリ | 82,380 KB |
実行使用メモリ | 66,380 KB |
最終ジャッジ日時 | 2024-11-08 21:54:10 |
合計ジャッジ時間 | 1,176 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 2 WA * 2 RE * 2 |
ソースコード
import sys import math def gcd(a, b): c = a d = b if c == 0 or d == 0: return max(a, b) if c < d: e = c c = d d = e while c % d != 0: c //= d e = c c = d d = e return d t = int(input()) for i in range(t): d, x, y = map(int, input().split()) if x == 0 or y == 0: print(max(x, y) * d) continue e = y f = x g = gcd(e, f) e //= g f //= g c = min((d - y) // f, x // e) e = min(y // f, (d - x) // e) print(max(0, max(c, e) * (x * x + y * y)))