結果

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

ソースコード

diff #

N, D = map(int, input().split())
ans = 0
p = []
cnt =[0] * (8 * 10**6 + 1)
## 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