結果

問題 No.1143 面積Nの三角形
ユーザー 37zigen
提出日時 2020-08-03 02:58:08
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 576 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-07-21 07:29:58
合計ジャッジ時間 8,053 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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)
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