結果

問題 No.411 昇順昇順ソート
ユーザー ThetaTheta
提出日時 2022-11-18 16:37:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 491 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 11,872 KB
実行使用メモリ 59,168 KB
最終ジャッジ日時 2023-10-20 02:37:52
合計ジャッジ時間 33,189 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 778 ms
54,848 KB
testcase_02 AC 780 ms
54,848 KB
testcase_03 AC 777 ms
54,848 KB
testcase_04 AC 769 ms
54,848 KB
testcase_05 AC 766 ms
54,848 KB
testcase_06 AC 777 ms
54,848 KB
testcase_07 AC 770 ms
54,848 KB
testcase_08 AC 779 ms
54,848 KB
testcase_09 AC 779 ms
54,848 KB
testcase_10 AC 773 ms
54,848 KB
testcase_11 AC 784 ms
54,848 KB
testcase_12 AC 776 ms
54,852 KB
testcase_13 AC 776 ms
54,852 KB
testcase_14 AC 781 ms
54,852 KB
testcase_15 AC 781 ms
54,852 KB
testcase_16 AC 787 ms
54,852 KB
testcase_17 AC 773 ms
54,852 KB
testcase_18 AC 778 ms
54,852 KB
testcase_19 AC 780 ms
54,852 KB
testcase_20 AC 777 ms
54,664 KB
testcase_21 AC 781 ms
54,852 KB
testcase_22 AC 787 ms
54,852 KB
testcase_23 AC 781 ms
54,664 KB
testcase_24 AC 786 ms
54,852 KB
testcase_25 AC 790 ms
54,852 KB
testcase_26 AC 776 ms
54,852 KB
testcase_27 AC 774 ms
54,852 KB
testcase_28 AC 790 ms
54,852 KB
testcase_29 AC 781 ms
54,852 KB
testcase_30 AC 784 ms
54,852 KB
testcase_31 AC 778 ms
54,852 KB
testcase_32 AC 772 ms
54,852 KB
testcase_33 AC 783 ms
59,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from scipy.special import comb


def main():
    N, K = map(int, input().split())
    if N == K:
        print(1)
        return

    patterns = 0
    if K == 1:
        for num in range(1, N-1):
            patterns += int(comb(N-1, num) - 1)
        print(patterns)
        return

    for num in range(N - K + 1):
        if num == 0:
            patterns += 1
            continue

        patterns += int(comb(N-K, num))
    print(int(patterns))


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