結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,996 KB
testcase_01 AC 16 ms
8,064 KB
testcase_02 AC 17 ms
8,004 KB
testcase_03 AC 20 ms
7,972 KB
testcase_04 AC 18 ms
8,020 KB
testcase_05 AC 20 ms
7,912 KB
testcase_06 AC 20 ms
7,992 KB
testcase_07 AC 92 ms
8,048 KB
testcase_08 AC 162 ms
7,976 KB
testcase_09 AC 211 ms
7,912 KB
testcase_10 AC 162 ms
8,000 KB
testcase_11 AC 495 ms
8,000 KB
testcase_12 AC 605 ms
7,992 KB
testcase_13 AC 606 ms
8,012 KB
testcase_14 AC 204 ms
7,956 KB
testcase_15 AC 16 ms
7,992 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

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
        if not issqrt(m):
            continue
        m = int(round(math.sqrt(m)))
        if (-(u + v) + m) % 2 != 0:
            continue
        w = (-(u + v) + m) // 2
        if not (u <= v <= w):
            continue
        cnt += 1
print(cnt)
0