結果

問題 No.800 四平方定理
ユーザー URechaRechaURechaRecha
提出日時 2019-09-05 17:09:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,148 ms / 2,000 ms
コード長 298 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 10,612 KB
実行使用メモリ 70,680 KB
最終ジャッジ日時 2023-09-02 13:26:09
合計ジャッジ時間 17,709 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
70,544 KB
testcase_01 AC 62 ms
70,316 KB
testcase_02 AC 60 ms
70,388 KB
testcase_03 AC 61 ms
70,384 KB
testcase_04 AC 60 ms
70,580 KB
testcase_05 AC 60 ms
70,520 KB
testcase_06 AC 64 ms
70,556 KB
testcase_07 AC 64 ms
70,352 KB
testcase_08 AC 67 ms
70,396 KB
testcase_09 AC 62 ms
70,416 KB
testcase_10 AC 554 ms
70,544 KB
testcase_11 AC 595 ms
70,488 KB
testcase_12 AC 593 ms
70,604 KB
testcase_13 AC 528 ms
70,644 KB
testcase_14 AC 560 ms
70,408 KB
testcase_15 AC 627 ms
70,408 KB
testcase_16 AC 584 ms
70,408 KB
testcase_17 AC 561 ms
70,472 KB
testcase_18 AC 624 ms
70,680 KB
testcase_19 AC 628 ms
70,528 KB
testcase_20 AC 51 ms
70,348 KB
testcase_21 AC 51 ms
70,388 KB
testcase_22 AC 617 ms
70,584 KB
testcase_23 AC 1,071 ms
70,448 KB
testcase_24 AC 1,022 ms
70,460 KB
testcase_25 AC 1,148 ms
70,352 KB
testcase_26 AC 52 ms
70,496 KB
testcase_27 AC 51 ms
70,464 KB
testcase_28 AC 1,046 ms
70,380 KB
testcase_29 AC 1,119 ms
70,516 KB
testcase_30 AC 1,036 ms
70,392 KB
testcase_31 AC 971 ms
70,516 KB
testcase_32 AC 1,053 ms
70,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N,D = map(int,input().split())
    s = [i**2 for i in range(1,N+1)]
    c = [0]*8000001
    for w in s:
        for z in s:
            a = w-z+D
            if a >=1:
                c[a] +=1
    A = 0
    for x in s:
        for y in s:
            A +=c[x+y]
    print(A)

main()
0