結果

問題 No.800 四平方定理
ユーザー aqua_tenhou
提出日時 2021-06-24 21:56:38
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 352 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 257,736 KB
最終ジャッジ日時 2024-06-25 07:33:40
合計ジャッジ時間 27,552 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

n,d = map(int,input().split())

dic = {}
for i in range(1, n+1):
    for j in range(1, n+1):
        if i**2 - j**2 in dic:
            dic[i**2 - j**2] += 1
        else:
            dic[i**2 - j**2] = 1

ans = 0
for i in range(1, n+1):
    for j in range(1, n+1):
        if d - i**2 - j**2 in dic:
            ans += dic[d - i**2 - j**2]
print(ans)
0