結果

問題 No.411 昇順昇順ソート
ユーザー Daigo HIROOKADaigo HIROOKA
提出日時 2018-07-03 01:34:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 409 bytes
コンパイル時間 3,302 ms
コンパイル使用メモリ 72,160 KB
実行使用メモリ 56,044 KB
最終ジャッジ日時 2023-09-13 17:09:00
合計ジャッジ時間 8,846 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,816 KB
testcase_01 AC 125 ms
55,488 KB
testcase_02 AC 125 ms
55,736 KB
testcase_03 AC 125 ms
55,960 KB
testcase_04 AC 125 ms
55,780 KB
testcase_05 AC 125 ms
55,528 KB
testcase_06 AC 126 ms
56,036 KB
testcase_07 AC 125 ms
55,612 KB
testcase_08 AC 125 ms
55,824 KB
testcase_09 AC 123 ms
55,744 KB
testcase_10 AC 124 ms
55,660 KB
testcase_11 AC 123 ms
55,540 KB
testcase_12 AC 125 ms
55,632 KB
testcase_13 AC 127 ms
56,044 KB
testcase_14 AC 125 ms
55,644 KB
testcase_15 AC 125 ms
55,684 KB
testcase_16 AC 126 ms
55,952 KB
testcase_17 AC 125 ms
55,808 KB
testcase_18 AC 126 ms
55,692 KB
testcase_19 AC 127 ms
55,840 KB
testcase_20 AC 125 ms
55,824 KB
testcase_21 AC 127 ms
55,712 KB
testcase_22 AC 124 ms
55,564 KB
testcase_23 AC 126 ms
55,700 KB
testcase_24 AC 126 ms
55,696 KB
testcase_25 AC 125 ms
55,864 KB
testcase_26 AC 125 ms
55,780 KB
testcase_27 AC 125 ms
55,472 KB
testcase_28 AC 125 ms
55,644 KB
testcase_29 AC 126 ms
55,480 KB
testcase_30 AC 126 ms
55,772 KB
testcase_31 AC 124 ms
55,816 KB
testcase_32 AC 126 ms
55,784 KB
testcase_33 AC 125 ms
55,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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

		int n = sc.nextInt();
		int k = sc.nextInt();
		if(k == 1){
			System.out.println(aasort(n));
		}else{
			System.out.println((int)Math.pow(2, n-k));
		}
	}
	private static int aasort(int n){
		if(n == 2){
			return 0;
		}else{
			return (int)Math.pow(2, n-2)-1 + aasort(n-1);
		}
	}
}
0