結果
| 問題 | No.1143 面積Nの三角形 |
| コンテスト | |
| ユーザー |
anagohirame
|
| 提出日時 | 2020-07-31 23:44:14 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 699 ms / 800 ms |
| コード長 | 752 bytes |
| 記録 | |
| コンパイル時間 | 300 ms |
| コンパイル使用メモリ | 85,204 KB |
| 実行使用メモリ | 82,700 KB |
| 最終ジャッジ日時 | 2026-03-28 12:03:59 |
| 合計ジャッジ時間 | 5,295 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
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))
anagohirame