結果

問題 No.800 四平方定理
ユーザー Ryushi-techRyushi-tech
提出日時 2020-08-28 09:00:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 278 ms / 2,000 ms
コード長 318 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 218,604 KB
最終ジャッジ日時 2024-04-26 10:32:22
合計ジャッジ時間 6,945 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
216,204 KB
testcase_01 AC 107 ms
217,032 KB
testcase_02 AC 110 ms
217,104 KB
testcase_03 AC 107 ms
216,816 KB
testcase_04 AC 109 ms
216,884 KB
testcase_05 AC 107 ms
216,640 KB
testcase_06 AC 107 ms
217,384 KB
testcase_07 AC 105 ms
217,044 KB
testcase_08 AC 106 ms
217,144 KB
testcase_09 AC 128 ms
216,816 KB
testcase_10 AC 166 ms
217,976 KB
testcase_11 AC 183 ms
218,052 KB
testcase_12 AC 181 ms
217,888 KB
testcase_13 AC 174 ms
218,152 KB
testcase_14 AC 179 ms
218,092 KB
testcase_15 AC 170 ms
217,868 KB
testcase_16 AC 176 ms
218,196 KB
testcase_17 AC 180 ms
218,128 KB
testcase_18 AC 175 ms
217,904 KB
testcase_19 AC 180 ms
217,804 KB
testcase_20 AC 91 ms
208,736 KB
testcase_21 AC 90 ms
208,252 KB
testcase_22 AC 182 ms
217,780 KB
testcase_23 AC 258 ms
218,152 KB
testcase_24 AC 278 ms
218,088 KB
testcase_25 AC 255 ms
218,604 KB
testcase_26 AC 90 ms
208,064 KB
testcase_27 AC 89 ms
208,336 KB
testcase_28 AC 258 ms
217,912 KB
testcase_29 AC 263 ms
217,940 KB
testcase_30 AC 264 ms
218,132 KB
testcase_31 AC 245 ms
217,820 KB
testcase_32 AC 261 ms
218,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, D = map(int, input().split())
lim = 2 * 10 ** 7
base = lim // 2
res = [0] * lim

for i in range(1, n + 1):
    for j in range(1, n + 1):
        res[i ** 2 + j ** 2 + base] += 1

cnt = 0
for i in range(1, n + 1):
    for j in range(1, n + 1):
        d = D - i ** 2 + j ** 2
        cnt += res[base + d]
print(cnt)
0