結果

問題 No.800 四平方定理
ユーザー TakoKurage
提出日時 2019-03-17 23:37:26
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 434 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 81,976 KB
実行使用メモリ 204,036 KB
最終ジャッジ日時 2024-07-08 05:56:04
合計ジャッジ時間 5,047 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 RE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

N, D = [int(i) for i in input().split()]

count1 = [0] * (2 * N * N + D)
for x in range(1, N + 1):
    for y in range(1, N + 1):
        count1[x * x + y * y] += 1

count2 = [0] * (2 * N * N + D)
for w in range(1, N + 1):
    for z in range(1, N + 1):
        temp = w * w - z * z + D
        if 0 <= temp:
            count2[w * w - z * z + D] += 1

result = 0
for c1, c2 in zip(count1, count2):
    result += c1 * c2

print(result)
0