結果

問題 No.800 四平方定理
ユーザー ntk-ta01ntk-ta01
提出日時 2020-08-01 15:40:50
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 476 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 202,244 KB
最終ジャッジ日時 2023-09-22 10:51:24
合計ジャッジ時間 7,426 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
77,192 KB
testcase_01 AC 85 ms
78,824 KB
testcase_02 AC 84 ms
78,100 KB
testcase_03 AC 87 ms
78,396 KB
testcase_04 AC 84 ms
78,112 KB
testcase_05 AC 87 ms
78,096 KB
testcase_06 AC 87 ms
79,244 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 84 ms
79,000 KB
testcase_10 AC 173 ms
138,896 KB
testcase_11 AC 186 ms
146,596 KB
testcase_12 AC 181 ms
145,284 KB
testcase_13 AC 194 ms
141,708 KB
testcase_14 AC 188 ms
146,524 KB
testcase_15 AC 194 ms
145,884 KB
testcase_16 AC 183 ms
147,312 KB
testcase_17 AC 188 ms
147,352 KB
testcase_18 AC 182 ms
147,036 KB
testcase_19 AC 181 ms
147,060 KB
testcase_20 AC 71 ms
71,180 KB
testcase_21 RE -
testcase_22 AC 187 ms
147,176 KB
testcase_23 AC 284 ms
202,244 KB
testcase_24 AC 279 ms
202,016 KB
testcase_25 AC 287 ms
201,672 KB
testcase_26 AC 73 ms
71,412 KB
testcase_27 RE -
testcase_28 AC 297 ms
201,236 KB
testcase_29 AC 278 ms
201,756 KB
testcase_30 AC 285 ms
201,688 KB
testcase_31 AC 266 ms
192,636 KB
testcase_32 AC 294 ms
202,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

    cA = [0]*(2*N**2+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]*(2*N**2+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