結果

問題 No.1143 面積Nの三角形
ユーザー 37zigen37zigen
提出日時 2020-08-03 02:59:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 218 ms / 800 ms
コード長 567 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 77,548 KB
最終ジャッジ日時 2023-09-28 12:54:28
合計ジャッジ時間 3,822 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,548 KB
testcase_01 AC 74 ms
71,336 KB
testcase_02 AC 83 ms
76,460 KB
testcase_03 AC 80 ms
76,692 KB
testcase_04 AC 73 ms
71,324 KB
testcase_05 AC 82 ms
76,472 KB
testcase_06 AC 84 ms
76,304 KB
testcase_07 AC 95 ms
76,612 KB
testcase_08 AC 102 ms
76,768 KB
testcase_09 AC 107 ms
76,852 KB
testcase_10 AC 94 ms
76,508 KB
testcase_11 AC 150 ms
77,516 KB
testcase_12 AC 159 ms
77,528 KB
testcase_13 AC 158 ms
77,284 KB
testcase_14 AC 96 ms
76,700 KB
testcase_15 AC 71 ms
71,316 KB
testcase_16 AC 218 ms
77,396 KB
testcase_17 AC 201 ms
77,548 KB
testcase_18 AC 186 ms
77,288 KB
testcase_19 AC 193 ms
77,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
def issqrt(n):
    x = int(round(math.sqrt(n)))
    return ((x * x) == n, x)
cnt = 0
N = int(input())
N2 = N * N
div = [x for x in range(1,N+1) if N2 % x == 0]
for u in div:
    for v in div:
        if N2 % (u * v) != 0:
            continue
        n = N2 // u // v
        m = (u + v) * (u + v) + 4 * n
        f = issqrt(m)
        if not f[0]:
            continue
        m = f[1]
        if (-(u + v) + m) % 2 != 0:
            continue
        w = (-(u + v) + m) // 2
        if not (u <= v <= w):
            continue
        cnt += 1
print(cnt)
0