結果

問題 No.800 四平方定理
ユーザー dangodango
提出日時 2023-07-08 09:19:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 305 ms / 2,000 ms
コード長 280 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,224 KB
実行使用メモリ 339,008 KB
最終ジャッジ日時 2023-09-29 10:36:29
合計ジャッジ時間 8,599 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 189 ms
338,272 KB
testcase_01 AC 194 ms
338,744 KB
testcase_02 AC 190 ms
338,580 KB
testcase_03 AC 189 ms
338,588 KB
testcase_04 AC 189 ms
338,604 KB
testcase_05 AC 218 ms
338,432 KB
testcase_06 AC 159 ms
338,788 KB
testcase_07 AC 154 ms
338,472 KB
testcase_08 AC 155 ms
338,624 KB
testcase_09 AC 158 ms
338,644 KB
testcase_10 AC 202 ms
338,872 KB
testcase_11 AC 207 ms
338,856 KB
testcase_12 AC 204 ms
338,848 KB
testcase_13 AC 200 ms
338,736 KB
testcase_14 AC 204 ms
338,880 KB
testcase_15 AC 216 ms
338,824 KB
testcase_16 AC 199 ms
338,596 KB
testcase_17 AC 243 ms
338,772 KB
testcase_18 AC 215 ms
338,740 KB
testcase_19 AC 214 ms
338,876 KB
testcase_20 AC 146 ms
334,012 KB
testcase_21 AC 147 ms
334,016 KB
testcase_22 AC 217 ms
339,000 KB
testcase_23 AC 305 ms
338,992 KB
testcase_24 AC 261 ms
338,740 KB
testcase_25 AC 270 ms
338,876 KB
testcase_26 AC 144 ms
333,912 KB
testcase_27 AC 143 ms
333,832 KB
testcase_28 AC 250 ms
338,984 KB
testcase_29 AC 252 ms
338,848 KB
testcase_30 AC 255 ms
339,008 KB
testcase_31 AC 243 ms
338,860 KB
testcase_32 AC 268 ms
338,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

c = [0] * (1 << 25)
s = 0
n, d = map(int, input().split())
for i in range(1, n + 1):
    for j in range(1, n + 1):
        t = i * i - j * j + d
        if t > 0:
            c[t] += 1
for k in range(1, n + 1):
    for j in range(1, n + 1):
        s += c[k * k + j * j]
print(s)
0