結果

問題 No.411 昇順昇順ソート
ユーザー YamaKasa
提出日時 2018-09-19 23:21:59
言語 Java
(openjdk 23)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 341 bytes
コンパイル時間 2,118 ms
コンパイル使用メモリ 74,084 KB
実行使用メモリ 41,704 KB
最終ジャッジ日時 2024-07-18 08:21:53
合計ジャッジ時間 7,117 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int K = scan.nextInt();
		scan.close();
		int ans;
		if(K == 1) {
			ans = (int)Math.pow(2, N - K) - N;
		}else {
			ans = (int)Math.pow(2, N - K);
		}
		System.out.println(ans);
	}
}
0