結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
70,516 KB
testcase_01 AC 64 ms
70,516 KB
testcase_02 AC 61 ms
70,480 KB
testcase_03 AC 61 ms
70,400 KB
testcase_04 AC 60 ms
70,572 KB
testcase_05 AC 63 ms
70,476 KB
testcase_06 AC 67 ms
70,496 KB
testcase_07 AC 66 ms
70,356 KB
testcase_08 AC 69 ms
70,484 KB
testcase_09 AC 63 ms
70,368 KB
testcase_10 AC 594 ms
70,524 KB
testcase_11 AC 640 ms
70,484 KB
testcase_12 AC 653 ms
70,332 KB
testcase_13 AC 556 ms
70,408 KB
testcase_14 AC 593 ms
70,360 KB
testcase_15 AC 652 ms
70,520 KB
testcase_16 AC 612 ms
70,388 KB
testcase_17 AC 606 ms
70,376 KB
testcase_18 AC 749 ms
70,480 KB
testcase_19 AC 699 ms
70,400 KB
testcase_20 AC 53 ms
70,360 KB
testcase_21 AC 52 ms
70,248 KB
testcase_22 AC 715 ms
70,376 KB
testcase_23 AC 1,224 ms
70,580 KB
testcase_24 AC 1,098 ms
70,416 KB
testcase_25 AC 1,218 ms
70,724 KB
testcase_26 AC 53 ms
70,496 KB
testcase_27 AC 52 ms
70,424 KB
testcase_28 AC 1,098 ms
70,744 KB
testcase_29 AC 1,153 ms
70,596 KB
testcase_30 AC 1,100 ms
70,628 KB
testcase_31 AC 1,013 ms
70,480 KB
testcase_32 AC 1,093 ms
70,588 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)


if __name__ == '__main__':
    main()
0