結果

問題 No.1143 面積Nの三角形
ユーザー 37zigen37zigen
提出日時 2020-08-03 02:58:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 576 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 10,780 KB
実行使用メモリ 8,108 KB
最終ジャッジ日時 2023-09-28 12:52:37
合計ジャッジ時間 6,972 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,048 KB
testcase_01 AC 18 ms
7,988 KB
testcase_02 AC 17 ms
8,000 KB
testcase_03 AC 18 ms
7,964 KB
testcase_04 AC 18 ms
7,928 KB
testcase_05 AC 18 ms
7,988 KB
testcase_06 AC 21 ms
8,020 KB
testcase_07 AC 73 ms
7,928 KB
testcase_08 AC 104 ms
8,000 KB
testcase_09 AC 140 ms
8,108 KB
testcase_10 AC 91 ms
8,044 KB
testcase_11 AC 415 ms
7,940 KB
testcase_12 AC 516 ms
8,072 KB
testcase_13 AC 527 ms
7,932 KB
testcase_14 AC 105 ms
8,012 KB
testcase_15 AC 17 ms
7,984 KB
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 AC 777 ms
7,972 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 u > v or 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