結果

問題 No.800 四平方定理
ユーザー _matumo__matumo_
提出日時 2020-08-25 18:13:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,259 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 73,344 KB
最終ジャッジ日時 2024-04-24 04:44:11
合計ジャッジ時間 17,588 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
73,216 KB
testcase_01 AC 90 ms
73,216 KB
testcase_02 AC 87 ms
73,216 KB
testcase_03 AC 87 ms
73,344 KB
testcase_04 AC 88 ms
73,216 KB
testcase_05 AC 89 ms
73,216 KB
testcase_06 AC 95 ms
73,344 KB
testcase_07 AC 93 ms
73,216 KB
testcase_08 AC 99 ms
73,344 KB
testcase_09 AC 88 ms
73,216 KB
testcase_10 AC 549 ms
73,216 KB
testcase_11 AC 586 ms
73,344 KB
testcase_12 AC 643 ms
73,216 KB
testcase_13 AC 516 ms
73,216 KB
testcase_14 AC 562 ms
73,216 KB
testcase_15 AC 614 ms
73,216 KB
testcase_16 AC 559 ms
73,216 KB
testcase_17 AC 564 ms
73,216 KB
testcase_18 AC 697 ms
73,216 KB
testcase_19 AC 716 ms
73,216 KB
testcase_20 AC 79 ms
73,216 KB
testcase_21 AC 79 ms
73,344 KB
testcase_22 AC 721 ms
73,216 KB
testcase_23 AC 1,216 ms
73,216 KB
testcase_24 AC 1,039 ms
73,216 KB
testcase_25 AC 1,259 ms
73,344 KB
testcase_26 AC 82 ms
73,344 KB
testcase_27 AC 80 ms
73,344 KB
testcase_28 AC 980 ms
73,216 KB
testcase_29 AC 1,157 ms
73,216 KB
testcase_30 AC 1,021 ms
73,216 KB
testcase_31 AC 909 ms
73,216 KB
testcase_32 AC 1,024 ms
73,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N,D=map(int,input().split())
    v=list([n*n for n in range(1,N+1)])
    p=[0]*8000001
    for x in v: 
        for y in v:  p[x+y]+=1
    sm=0
    for w in v:
        for z in v:
            n=w-z+D
            if n<1: break
            sm+=p[n]
    print(sm)
main()
0