結果

問題 No.411 昇順昇順ソート
ユーザー TatsuDXTatsuDX
提出日時 2016-09-09 00:39:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 290 bytes
コンパイル時間 2,878 ms
コンパイル使用メモリ 74,608 KB
実行使用メモリ 54,580 KB
最終ジャッジ日時 2024-04-27 18:22:19
合計ジャッジ時間 7,331 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
53,800 KB
testcase_01 AC 95 ms
52,824 KB
testcase_02 AC 103 ms
54,040 KB
testcase_03 AC 105 ms
53,764 KB
testcase_04 AC 108 ms
53,772 KB
testcase_05 AC 96 ms
52,648 KB
testcase_06 AC 110 ms
53,696 KB
testcase_07 AC 105 ms
53,628 KB
testcase_08 AC 106 ms
53,504 KB
testcase_09 AC 105 ms
53,920 KB
testcase_10 AC 106 ms
53,740 KB
testcase_11 AC 113 ms
53,700 KB
testcase_12 AC 106 ms
53,516 KB
testcase_13 AC 105 ms
52,564 KB
testcase_14 AC 94 ms
52,588 KB
testcase_15 AC 106 ms
53,732 KB
testcase_16 AC 105 ms
53,540 KB
testcase_17 AC 102 ms
53,620 KB
testcase_18 AC 106 ms
53,800 KB
testcase_19 AC 107 ms
53,904 KB
testcase_20 AC 109 ms
53,964 KB
testcase_21 AC 95 ms
52,536 KB
testcase_22 AC 103 ms
53,604 KB
testcase_23 AC 106 ms
53,648 KB
testcase_24 AC 98 ms
53,000 KB
testcase_25 AC 107 ms
53,912 KB
testcase_26 AC 96 ms
54,580 KB
testcase_27 AC 105 ms
52,864 KB
testcase_28 AC 109 ms
53,772 KB
testcase_29 AC 108 ms
54,136 KB
testcase_30 AC 106 ms
54,184 KB
testcase_31 AC 106 ms
53,788 KB
testcase_32 AC 106 ms
53,576 KB
testcase_33 AC 108 ms
53,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt(), k = sc.nextInt(), ans = 1;
		for(int i = k+1; i <= n; i++){
			ans *= 2;
		}
		if(k == 1){
			ans-=n;
		}
		System.out.println(ans);
	}
}
0