結果

問題 No.800 四平方定理
ユーザー kurimupykurimupy
提出日時 2020-06-16 00:12:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 382 ms / 2,000 ms
コード長 368 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 87,240 KB
実行使用メモリ 201,824 KB
最終ジャッジ日時 2023-09-16 10:42:58
合計ジャッジ時間 10,302 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 192 ms
201,352 KB
testcase_01 AC 191 ms
201,760 KB
testcase_02 AC 190 ms
201,612 KB
testcase_03 AC 191 ms
201,528 KB
testcase_04 AC 190 ms
201,580 KB
testcase_05 AC 192 ms
201,420 KB
testcase_06 AC 189 ms
201,592 KB
testcase_07 AC 182 ms
201,452 KB
testcase_08 AC 190 ms
201,324 KB
testcase_09 AC 196 ms
201,596 KB
testcase_10 AC 273 ms
201,504 KB
testcase_11 AC 274 ms
201,824 KB
testcase_12 AC 275 ms
201,640 KB
testcase_13 AC 258 ms
201,556 KB
testcase_14 AC 257 ms
201,700 KB
testcase_15 AC 277 ms
201,452 KB
testcase_16 AC 258 ms
201,332 KB
testcase_17 AC 271 ms
201,612 KB
testcase_18 AC 298 ms
201,456 KB
testcase_19 AC 298 ms
201,324 KB
testcase_20 AC 181 ms
201,096 KB
testcase_21 AC 181 ms
201,304 KB
testcase_22 AC 301 ms
201,512 KB
testcase_23 AC 382 ms
201,332 KB
testcase_24 AC 328 ms
201,384 KB
testcase_25 AC 379 ms
201,560 KB
testcase_26 AC 184 ms
200,820 KB
testcase_27 AC 184 ms
200,960 KB
testcase_28 AC 353 ms
201,476 KB
testcase_29 AC 360 ms
201,796 KB
testcase_30 AC 338 ms
201,484 KB
testcase_31 AC 319 ms
201,692 KB
testcase_32 AC 345 ms
201,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#4平方定理
N, D = map(int, input().split())
d = [0 for i in range(8*10**6+2)]
e = [0 for i in range(8*10**6+2)]
for i in range(1, N+1):
    for j in range(1, N+1):
        d[i**2+j**2] += 1
for i in range(1, N+1):
    for j in range(1, N+1):
        e[min(8*10**6+1, max(0,i**2-j**2+D))] += 1
ans = 0
for i in range(1, 8*10**6+1):
    ans += d[i]*e[i]
print(ans)

0