結果

問題 No.1143 面積Nの三角形
ユーザー 37zigen
提出日時 2020-08-03 02:50:03
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 606 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-21 07:18:05
合計ジャッジ時間 8,641 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 TLE * 1
other AC * 15 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

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