結果

問題 No.2953 Maximum Right Triangle
ユーザー nikoro256
提出日時 2024-11-08 22:29:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 388 bytes
コンパイル時間 441 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 53,248 KB
最終ジャッジ日時 2024-11-08 22:29:11
合計ジャッジ時間 1,292 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 4 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
T=int(input())
for _ in range(T):
    D,x,y=map(int,input().split())
    if x==0 or y==0:
        l=x
        if y!=0:
            l=y
        print(l*l*(D//l))
        continue
    gcd=math.gcd(x,y)
    x2,y2=x//math.gcd(x,y),y//math.gcd(x,y)
    s1=min((D-x)//y2,y//x2)
    s2=min((D-y)//x2,x//y2)
    base=x2**2+y2**2
    #print(base,s1,s2)
    print(base*gcd*max(s1,s2,0))
0