結果

問題 No.800 四平方定理
ユーザー Ryushi-techRyushi-tech
提出日時 2020-08-28 08:58:01
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 314 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 146,432 KB
最終ジャッジ日時 2024-04-26 10:31:46
合計ジャッジ時間 5,926 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
138,120 KB
testcase_01 AC 87 ms
138,788 KB
testcase_02 AC 86 ms
138,724 KB
testcase_03 AC 87 ms
139,008 KB
testcase_04 AC 90 ms
138,624 KB
testcase_05 AC 86 ms
138,564 KB
testcase_06 AC 88 ms
138,880 KB
testcase_07 AC 89 ms
138,852 KB
testcase_08 AC 90 ms
138,624 KB
testcase_09 AC 89 ms
138,752 KB
testcase_10 AC 166 ms
139,756 KB
testcase_11 AC 183 ms
140,032 KB
testcase_12 AC 203 ms
140,288 KB
testcase_13 AC 172 ms
139,736 KB
testcase_14 AC 178 ms
139,760 KB
testcase_15 AC 184 ms
139,924 KB
testcase_16 AC 180 ms
139,648 KB
testcase_17 AC 208 ms
139,648 KB
testcase_18 AC 181 ms
139,924 KB
testcase_19 AC 179 ms
139,564 KB
testcase_20 AC 76 ms
130,048 KB
testcase_21 AC 76 ms
130,048 KB
testcase_22 AC 178 ms
139,760 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 76 ms
130,048 KB
testcase_27 AC 76 ms
130,348 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, D = map(int, input().split())
lim = 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