結果

問題 No.800 四平方定理
ユーザー ntk-ta01ntk-ta01
提出日時 2020-08-01 15:54:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 369 ms / 2,000 ms
コード長 475 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 264,500 KB
最終ジャッジ日時 2023-09-22 10:52:05
合計ジャッジ時間 10,639 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 199 ms
263,756 KB
testcase_01 AC 204 ms
264,384 KB
testcase_02 AC 204 ms
264,100 KB
testcase_03 AC 207 ms
264,208 KB
testcase_04 AC 200 ms
264,224 KB
testcase_05 AC 205 ms
264,108 KB
testcase_06 AC 200 ms
264,112 KB
testcase_07 AC 206 ms
264,476 KB
testcase_08 AC 203 ms
264,048 KB
testcase_09 AC 203 ms
264,200 KB
testcase_10 AC 273 ms
264,240 KB
testcase_11 AC 289 ms
264,392 KB
testcase_12 AC 286 ms
264,240 KB
testcase_13 AC 277 ms
264,208 KB
testcase_14 AC 282 ms
264,332 KB
testcase_15 AC 286 ms
264,192 KB
testcase_16 AC 288 ms
264,412 KB
testcase_17 AC 289 ms
264,452 KB
testcase_18 AC 287 ms
264,048 KB
testcase_19 AC 280 ms
263,904 KB
testcase_20 AC 179 ms
263,140 KB
testcase_21 AC 180 ms
263,492 KB
testcase_22 AC 283 ms
264,012 KB
testcase_23 AC 368 ms
264,448 KB
testcase_24 AC 369 ms
264,388 KB
testcase_25 AC 365 ms
264,212 KB
testcase_26 AC 178 ms
263,428 KB
testcase_27 AC 180 ms
263,396 KB
testcase_28 AC 366 ms
264,200 KB
testcase_29 AC 364 ms
264,212 KB
testcase_30 AC 364 ms
264,068 KB
testcase_31 AC 349 ms
263,936 KB
testcase_32 AC 363 ms
264,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ADD = 4*10**6


def main():
    N, D = (int(i) for i in input().split())

    cA = [0]*(3*ADD+1)
    for x in range(1, N+1):
        for y in range(1, N+1):
            v = x**2 + y**2 + ADD
            cA[v] += 1

    cB = [0]*(3*ADD+1)
    for z in range(1, N+1):
        for w in range(1, N+1):
            v = w**2 - z**2 + D + ADD
            cB[v] += 1

    ans = 0
    for a, b in zip(cA, cB):
        ans += a*b
    print(ans)


if __name__ == '__main__':
    main()
0