結果

問題 No.800 四平方定理
ユーザー lumeffluxlumefflux
提出日時 2019-03-17 23:53:49
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 1,047 ms / 2,000 ms
コード長 386 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 10,620 KB
実行使用メモリ 70,656 KB
最終ジャッジ日時 2023-09-22 15:57:53
合計ジャッジ時間 16,058 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
70,320 KB
testcase_01 AC 61 ms
70,344 KB
testcase_02 AC 59 ms
70,464 KB
testcase_03 AC 60 ms
70,456 KB
testcase_04 AC 59 ms
70,520 KB
testcase_05 AC 58 ms
70,388 KB
testcase_06 AC 64 ms
70,460 KB
testcase_07 AC 63 ms
70,504 KB
testcase_08 AC 66 ms
70,464 KB
testcase_09 AC 62 ms
70,308 KB
testcase_10 AC 490 ms
70,532 KB
testcase_11 AC 520 ms
70,452 KB
testcase_12 AC 550 ms
70,512 KB
testcase_13 AC 487 ms
70,420 KB
testcase_14 AC 510 ms
70,456 KB
testcase_15 AC 545 ms
70,588 KB
testcase_16 AC 524 ms
70,360 KB
testcase_17 AC 523 ms
70,572 KB
testcase_18 AC 625 ms
70,544 KB
testcase_19 AC 605 ms
70,508 KB
testcase_20 AC 51 ms
70,280 KB
testcase_21 AC 51 ms
70,440 KB
testcase_22 AC 576 ms
70,492 KB
testcase_23 AC 1,047 ms
70,452 KB
testcase_24 AC 938 ms
70,640 KB
testcase_25 AC 1,036 ms
70,656 KB
testcase_26 AC 51 ms
70,392 KB
testcase_27 AC 51 ms
70,336 KB
testcase_28 AC 942 ms
70,404 KB
testcase_29 AC 1,008 ms
70,524 KB
testcase_30 AC 1,003 ms
70,428 KB
testcase_31 AC 849 ms
70,472 KB
testcase_32 AC 947 ms
70,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    N, D = map(int, input().split())
    p = []
    c = [0] * 8000001
    for i in range(1, N + 1):
        p.append(i**2)
    for i in p:
        for j in p:
            s = i - j + D
            if s >= 1:
                c[s] += 1
    res = 0
    for i in p:
        for j in p:
            res += c[i + j]
    print(res)
    
    
if __name__ == "__main__":
    solve()
0