結果

問題 No.1143 面積Nの三角形
ユーザー convexineqconvexineq
提出日時 2021-05-12 08:50:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 108 ms / 800 ms
コード長 740 bytes
コンパイル時間 884 ms
コンパイル使用メモリ 81,676 KB
実行使用メモリ 70,480 KB
最終ジャッジ日時 2023-10-23 20:46:03
合計ジャッジ時間 3,640 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,448 KB
testcase_01 AC 36 ms
53,448 KB
testcase_02 AC 36 ms
53,448 KB
testcase_03 AC 41 ms
59,516 KB
testcase_04 AC 37 ms
53,448 KB
testcase_05 AC 40 ms
59,516 KB
testcase_06 AC 45 ms
61,796 KB
testcase_07 AC 56 ms
64,264 KB
testcase_08 AC 61 ms
64,260 KB
testcase_09 AC 70 ms
66,348 KB
testcase_10 AC 59 ms
62,128 KB
testcase_11 AC 77 ms
68,424 KB
testcase_12 AC 79 ms
68,424 KB
testcase_13 AC 84 ms
68,400 KB
testcase_14 AC 60 ms
62,092 KB
testcase_15 AC 37 ms
53,448 KB
testcase_16 AC 95 ms
70,480 KB
testcase_17 AC 108 ms
70,480 KB
testcase_18 AC 94 ms
68,428 KB
testcase_19 AC 95 ms
70,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def divisor_list(N): #約数のリスト
    if N == 1: return [1]
    res = []
    for i in range(1,N):
        if i*i >= N: break
        if N%i == 0:
            res.append(i)
            res.append(N//i)
    if i*i == N: res.append(i)
    return sorted(res)

n = int(input())
N = n*n
div = divisor_list(N)
# pqr(p+q+r) = n*n なる (p,q,r)を求める
ans = 0
L = len(div)
for i,p in enumerate(div):
    if p*p > n: break
    for j in range(i,L):
        q = div[j]
        if p*q*q*(p+q+q) > N: break
        if N%(p*q): continue
        NN = N//p//q
        for k in range(j,L):
            r = div[k]
            V = r*(p+q+r)
            if V == NN:
                ans += 1
            elif V > NN:
                break
print(ans)
0