結果

問題 No.800 四平方定理
ユーザー NatsubiSoganNatsubiSogan
提出日時 2020-10-17 16:33:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 293 ms / 2,000 ms
コード長 411 bytes
コンパイル時間 604 ms
コンパイル使用メモリ 87,252 KB
実行使用メモリ 217,144 KB
最終ジャッジ日時 2023-09-28 08:22:58
合計ジャッジ時間 7,490 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
93,076 KB
testcase_01 AC 81 ms
94,444 KB
testcase_02 AC 78 ms
93,808 KB
testcase_03 AC 80 ms
94,164 KB
testcase_04 AC 77 ms
93,696 KB
testcase_05 AC 78 ms
93,980 KB
testcase_06 AC 80 ms
94,824 KB
testcase_07 AC 79 ms
94,328 KB
testcase_08 AC 78 ms
94,688 KB
testcase_09 AC 80 ms
94,472 KB
testcase_10 AC 159 ms
154,056 KB
testcase_11 AC 168 ms
161,680 KB
testcase_12 AC 170 ms
160,420 KB
testcase_13 AC 159 ms
156,748 KB
testcase_14 AC 160 ms
161,604 KB
testcase_15 AC 172 ms
161,256 KB
testcase_16 AC 162 ms
162,464 KB
testcase_17 AC 163 ms
162,548 KB
testcase_18 AC 177 ms
162,108 KB
testcase_19 AC 176 ms
162,376 KB
testcase_20 AC 66 ms
87,080 KB
testcase_21 AC 65 ms
87,196 KB
testcase_22 AC 180 ms
162,420 KB
testcase_23 AC 285 ms
216,808 KB
testcase_24 AC 293 ms
217,044 KB
testcase_25 AC 274 ms
216,860 KB
testcase_26 AC 67 ms
86,932 KB
testcase_27 AC 67 ms
86,828 KB
testcase_28 AC 255 ms
216,700 KB
testcase_29 AC 280 ms
216,784 KB
testcase_30 AC 264 ms
216,552 KB
testcase_31 AC 243 ms
207,856 KB
testcase_32 AC 254 ms
217,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, d = map(int, input().split())
c1, c2 = [0] * (2 * n ** 2 + 10 ** 6), [0] * (2 * n ** 2 + 10 ** 6)
for i in range(1, n + 1):
    for j in range(1, n + 1):
        c1[i ** 2 + j ** 2 - 1] += 1
for i in range(1, n + 1):
    for j in range(1, n + 1):
        if i ** 2 - j ** 2 + d - 1 >= 0:
            c2[i ** 2 - j ** 2 + d - 1] += 1
ans = 0
for i in range(2 * n ** 2 + 1):
    ans += c1[i] * c2[i]
print(ans)
0