結果

問題 No.800 四平方定理
ユーザー 910_sendai
提出日時 2019-03-18 12:38:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 295 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 73,396 KB
最終ジャッジ日時 2024-07-18 06:26:31
合計ジャッジ時間 33,672 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 TLE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

N, D = map(int, input().split())
ans = 0
p = []
cnt =[0] * 8 * 10**6
## x*x + y*y = s 
for i in range(1, N+1):
    p.append(i*i)

for z in p:
    for w in p:
        s = w - z + D
        if s >= 0:
            cnt[s] += 1

for x in p:
    for y in p:
        ans += cnt[x+y]
        
print(ans)
0