結果
問題 |
No.1143 面積Nの三角形
|
ユーザー |
![]() |
提出日時 | 2020-07-31 23:44:14 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 752 bytes |
コンパイル時間 | 167 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 78,384 KB |
最終ジャッジ日時 | 2024-07-06 21:59:32 |
合計ジャッジ時間 | 6,980 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 TLE * 1 |
other | AC * 16 TLE * 2 |
ソースコード
n = int(input()) div = [] for i in range(1, n+1): if (n*n)%i == 0: div.append(i) m = len(div) ans = set() for i in range(m): for j in range(i, m): x, y = div[i], div[j] #formula: xy z^2 + xy(x+y) z - n*n = 0 #answer: (-xy(x+y) +- sqrt(x^2y^2(x+y)^2 + 4n^2xy)) / 2xy if x*x*y*y*(x+y)*(x+y) + 4*n*n*x*y < 0: continue z1 = round((-x*y*(x+y) + (x*x*y*y*(x+y)*(x+y) + 4*n*n*x*y) ** 0.5) / (2*x*y)) z2 = round((-x*y*(x+y) - (x*x*y*y*(x+y)*(x+y) + 4*n*n*x*y) ** 0.5) / (2*x*y)) #print(x, y, z1, z2) if z1 > 0 and x*y*z1*(x+y+z1) == n*n: res = sorted([x, y, z1]) ans.add((res[0], res[1], res[2])) if z2 != z1 and z2 > 0 and x*y*z2*(x+y+z2) == n*n: res = sorted([x, y, z2]) ans.add((res[0], res[1], res[2])) print(len(ans))