結果

問題 No.800 四平方定理
ユーザー kamojirokamojiro
提出日時 2019-03-17 23:50:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 369 ms / 2,000 ms
コード長 350 bytes
コンパイル時間 248 ms
コンパイル使用メモリ 86,964 KB
実行使用メモリ 209,496 KB
最終ジャッジ日時 2023-09-22 15:46:43
合計ジャッジ時間 9,434 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 369 ms
208,400 KB
testcase_01 AC 205 ms
209,496 KB
testcase_02 AC 195 ms
209,088 KB
testcase_03 AC 183 ms
209,236 KB
testcase_04 AC 189 ms
209,240 KB
testcase_05 AC 184 ms
209,400 KB
testcase_06 AC 200 ms
209,240 KB
testcase_07 AC 161 ms
209,224 KB
testcase_08 AC 165 ms
209,464 KB
testcase_09 AC 174 ms
209,360 KB
testcase_10 AC 220 ms
209,280 KB
testcase_11 AC 228 ms
209,360 KB
testcase_12 AC 233 ms
209,360 KB
testcase_13 AC 225 ms
209,464 KB
testcase_14 AC 220 ms
209,460 KB
testcase_15 AC 228 ms
209,280 KB
testcase_16 AC 225 ms
209,276 KB
testcase_17 AC 227 ms
209,224 KB
testcase_18 AC 230 ms
209,224 KB
testcase_19 AC 232 ms
209,304 KB
testcase_20 AC 150 ms
208,632 KB
testcase_21 AC 153 ms
208,668 KB
testcase_22 AC 231 ms
209,316 KB
testcase_23 AC 303 ms
209,424 KB
testcase_24 AC 299 ms
209,160 KB
testcase_25 AC 305 ms
209,116 KB
testcase_26 AC 145 ms
208,796 KB
testcase_27 AC 151 ms
208,712 KB
testcase_28 AC 301 ms
209,436 KB
testcase_29 AC 304 ms
209,384 KB
testcase_30 AC 300 ms
209,292 KB
testcase_31 AC 290 ms
209,424 KB
testcase_32 AC 298 ms
209,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, D = map( int, input().split())
left = [0]*(8*(10**6)+1)
right = [0]*(9*(10**6)+1)
for i in range(1, N+1):
    for j in range(1, N+1):
        left[i**2 + j**2] += 1
for i in range(1, N+1):
    for j in range(1, N+1):
        right[i**2 - j**2 + D+4*10**6] += 1
ans = 0
for i in range(1, 4*10**6+D+1):
    ans += left[i]*right[i+4*10**6]
print(ans)
0