結果

問題 No.800 四平方定理
ユーザー ktgw0316
提出日時 2019-04-08 13:31:44
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 302 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 21,248 KB
最終ジャッジ日時 2024-07-01 22:51:35
合計ジャッジ時間 6,594 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other TLE * 1 -- * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

n, d = map(int, input().split())
count = 0
r = range(1, n + 1)
for x, y, z in itertools.product(r, r, r):
    s = x*x + y*y + z*z - d
    if (s <= 0):
        continue
    w = int(s ** 0.5 + 0.5)
    if (w <= n and w*w == s):
        #  print(x,y,z,w)
        count += 1
print(count)
0