結果

問題 No.411 昇順昇順ソート
ユーザー ThetaTheta
提出日時 2023-11-21 18:03:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 491 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 101,856 KB
最終ジャッジ日時 2023-11-21 18:04:06
合計ジャッジ時間 7,472 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 785 ms
54,888 KB
testcase_02 AC 798 ms
54,888 KB
testcase_03 AC 759 ms
54,888 KB
testcase_04 AC 820 ms
54,888 KB
testcase_05 AC 834 ms
54,888 KB
testcase_06 AC 768 ms
54,888 KB
testcase_07 AC 787 ms
54,888 KB
testcase_08 AC 778 ms
54,888 KB
testcase_09 AC 787 ms
54,888 KB
testcase_10 AC 799 ms
54,888 KB
testcase_11 AC 763 ms
54,888 KB
testcase_12 AC 797 ms
54,888 KB
testcase_13 AC 804 ms
54,888 KB
testcase_14 AC 771 ms
54,888 KB
testcase_15 AC 804 ms
54,888 KB
testcase_16 AC 806 ms
54,888 KB
testcase_17 AC 770 ms
54,888 KB
testcase_18 AC 786 ms
54,888 KB
testcase_19 AC 775 ms
54,888 KB
testcase_20 AC 815 ms
54,632 KB
testcase_21 AC 794 ms
54,888 KB
testcase_22 AC 757 ms
54,888 KB
testcase_23 AC 800 ms
54,632 KB
testcase_24 AC 785 ms
54,888 KB
testcase_25 AC 767 ms
54,888 KB
testcase_26 AC 794 ms
54,888 KB
testcase_27 AC 782 ms
54,888 KB
testcase_28 AC 761 ms
54,888 KB
testcase_29 AC 791 ms
54,888 KB
testcase_30 AC 763 ms
54,888 KB
testcase_31 AC 801 ms
54,888 KB
testcase_32 AC 789 ms
54,888 KB
testcase_33 AC 782 ms
101,856 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