結果

問題 No.800 四平方定理
ユーザー ntk-ta01ntk-ta01
提出日時 2020-08-01 15:41:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 286 ms / 2,000 ms
コード長 482 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 202,020 KB
最終ジャッジ日時 2023-09-22 10:51:35
合計ジャッジ時間 8,448 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 151 ms
200,768 KB
testcase_01 AC 154 ms
201,468 KB
testcase_02 AC 153 ms
201,544 KB
testcase_03 AC 153 ms
201,480 KB
testcase_04 AC 153 ms
201,240 KB
testcase_05 AC 153 ms
201,472 KB
testcase_06 AC 153 ms
201,320 KB
testcase_07 AC 157 ms
201,548 KB
testcase_08 AC 152 ms
201,388 KB
testcase_09 AC 151 ms
201,544 KB
testcase_10 AC 212 ms
201,864 KB
testcase_11 AC 223 ms
201,848 KB
testcase_12 AC 212 ms
201,948 KB
testcase_13 AC 211 ms
201,872 KB
testcase_14 AC 216 ms
201,748 KB
testcase_15 AC 216 ms
201,748 KB
testcase_16 AC 228 ms
201,824 KB
testcase_17 AC 211 ms
201,724 KB
testcase_18 AC 222 ms
201,752 KB
testcase_19 AC 212 ms
202,020 KB
testcase_20 AC 133 ms
200,444 KB
testcase_21 AC 135 ms
200,464 KB
testcase_22 AC 208 ms
201,952 KB
testcase_23 AC 285 ms
201,824 KB
testcase_24 AC 281 ms
201,724 KB
testcase_25 AC 281 ms
201,976 KB
testcase_26 AC 134 ms
200,420 KB
testcase_27 AC 135 ms
200,476 KB
testcase_28 AC 281 ms
201,976 KB
testcase_29 AC 279 ms
201,960 KB
testcase_30 AC 286 ms
201,808 KB
testcase_31 AC 270 ms
201,912 KB
testcase_32 AC 276 ms
201,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

C = 2*2000**2


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

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

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

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


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