結果

問題 No.800 四平方定理
ユーザー _matumo__matumo_
提出日時 2020-08-25 18:13:18
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 1,136 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 10,612 KB
実行使用メモリ 70,736 KB
最終ジャッジ日時 2023-08-06 08:43:20
合計ジャッジ時間 16,607 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
70,384 KB
testcase_01 AC 65 ms
70,392 KB
testcase_02 AC 58 ms
70,468 KB
testcase_03 AC 58 ms
70,440 KB
testcase_04 AC 59 ms
70,320 KB
testcase_05 AC 59 ms
70,324 KB
testcase_06 AC 62 ms
70,516 KB
testcase_07 AC 63 ms
70,392 KB
testcase_08 AC 67 ms
70,468 KB
testcase_09 AC 62 ms
70,492 KB
testcase_10 AC 527 ms
70,340 KB
testcase_11 AC 557 ms
70,504 KB
testcase_12 AC 598 ms
70,396 KB
testcase_13 AC 473 ms
70,456 KB
testcase_14 AC 507 ms
70,620 KB
testcase_15 AC 588 ms
70,540 KB
testcase_16 AC 521 ms
70,452 KB
testcase_17 AC 519 ms
70,736 KB
testcase_18 AC 689 ms
70,468 KB
testcase_19 AC 678 ms
70,408 KB
testcase_20 AC 51 ms
70,472 KB
testcase_21 AC 51 ms
70,460 KB
testcase_22 AC 671 ms
70,396 KB
testcase_23 AC 1,124 ms
70,648 KB
testcase_24 AC 940 ms
70,732 KB
testcase_25 AC 1,136 ms
70,608 KB
testcase_26 AC 51 ms
70,392 KB
testcase_27 AC 50 ms
70,340 KB
testcase_28 AC 956 ms
70,624 KB
testcase_29 AC 1,042 ms
70,620 KB
testcase_30 AC 936 ms
70,736 KB
testcase_31 AC 871 ms
70,704 KB
testcase_32 AC 972 ms
70,724 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