結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,060 KB
testcase_01 AC 16 ms
7,964 KB
testcase_02 AC 17 ms
7,988 KB
testcase_03 AC 18 ms
8,000 KB
testcase_04 AC 17 ms
7,988 KB
testcase_05 AC 19 ms
7,964 KB
testcase_06 AC 21 ms
7,920 KB
testcase_07 AC 94 ms
8,000 KB
testcase_08 AC 164 ms
7,972 KB
testcase_09 AC 214 ms
8,076 KB
testcase_10 AC 158 ms
7,968 KB
testcase_11 AC 500 ms
8,068 KB
testcase_12 AC 606 ms
7,988 KB
testcase_13 AC 626 ms
7,944 KB
testcase_14 AC 197 ms
8,040 KB
testcase_15 AC 16 ms
8,004 KB
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math


def issqrt(n):
    x = int(round(math.sqrt(n)))
    return ((x * x) == n, x)
div = []
cnt = 0
N = int(input())
for i in range(1, N + 1):
    if N * N % i == 0:
        div.append(i)
for u in div:
    for v in div:
        if u > v or N * N % (u * v) != 0:
            continue
        n = N * N // 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