結果

問題 No.800 四平方定理
ユーザー mlihua09mlihua09
提出日時 2020-08-29 19:42:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 344 ms / 2,000 ms
コード長 354 bytes
コンパイル時間 434 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 201,620 KB
最終ジャッジ日時 2023-08-09 10:29:13
合計ジャッジ時間 8,939 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
200,916 KB
testcase_01 AC 141 ms
201,144 KB
testcase_02 AC 138 ms
201,392 KB
testcase_03 AC 138 ms
201,312 KB
testcase_04 AC 136 ms
201,376 KB
testcase_05 AC 142 ms
201,308 KB
testcase_06 AC 141 ms
201,140 KB
testcase_07 AC 145 ms
201,516 KB
testcase_08 AC 140 ms
201,448 KB
testcase_09 AC 147 ms
201,584 KB
testcase_10 AC 244 ms
201,336 KB
testcase_11 AC 239 ms
201,620 KB
testcase_12 AC 240 ms
201,352 KB
testcase_13 AC 226 ms
201,396 KB
testcase_14 AC 233 ms
201,152 KB
testcase_15 AC 243 ms
201,564 KB
testcase_16 AC 222 ms
201,364 KB
testcase_17 AC 239 ms
201,432 KB
testcase_18 AC 252 ms
201,216 KB
testcase_19 AC 255 ms
201,484 KB
testcase_20 AC 131 ms
200,656 KB
testcase_21 AC 129 ms
200,596 KB
testcase_22 AC 254 ms
201,356 KB
testcase_23 AC 341 ms
201,480 KB
testcase_24 AC 297 ms
201,280 KB
testcase_25 AC 344 ms
201,536 KB
testcase_26 AC 136 ms
200,528 KB
testcase_27 AC 137 ms
200,796 KB
testcase_28 AC 300 ms
201,472 KB
testcase_29 AC 338 ms
201,332 KB
testcase_30 AC 304 ms
201,480 KB
testcase_31 AC 296 ms
201,216 KB
testcase_32 AC 313 ms
201,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


N, D = map(int, input().split())

X = [0] * (8 * 10 ** 6 + 1)
Y = [0] * (8 * 10 ** 6 + 1)
ans = 0

for i in range(1, N + 1):
    
    for j in range(1, N + 1):
        
        X[i ** 2 + j ** 2] += 1
        if i ** 2 - j ** 2 + D > 0:
            Y[i ** 2 - j ** 2 + D] += 1
        
for i in range(8 * 10 ** 6 + 1):
    ans += X[i] * Y[i]
print(ans)
0