結果
問題 | No.1143 面積Nの三角形 |
ユーザー | anagohirame |
提出日時 | 2020-07-31 23:44:14 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 752 bytes |
コンパイル時間 | 635 ms |
コンパイル使用メモリ | 87,004 KB |
実行使用メモリ | 79,584 KB |
最終ジャッジ日時 | 2023-09-21 03:19:52 |
合計ジャッジ時間 | 9,948 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 76 ms
71,772 KB |
testcase_01 | AC | 74 ms
71,636 KB |
testcase_02 | AC | 77 ms
71,804 KB |
testcase_03 | AC | 89 ms
76,796 KB |
testcase_04 | AC | 75 ms
71,640 KB |
testcase_05 | AC | 88 ms
76,596 KB |
testcase_06 | AC | 99 ms
77,392 KB |
testcase_07 | AC | 188 ms
79,284 KB |
testcase_08 | AC | 216 ms
79,584 KB |
testcase_09 | AC | 239 ms
79,012 KB |
testcase_10 | AC | 150 ms
77,872 KB |
testcase_11 | AC | 615 ms
79,376 KB |
testcase_12 | AC | 730 ms
78,576 KB |
testcase_13 | AC | 680 ms
78,736 KB |
testcase_14 | AC | 130 ms
78,056 KB |
testcase_15 | AC | 72 ms
71,480 KB |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
ソースコード
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))