結果

問題 No.411 昇順昇順ソート
ユーザー tsuchinagatsuchinaga
提出日時 2019-03-11 12:49:31
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 517 bytes
コンパイル時間 10,688 ms
コンパイル使用メモリ 207,548 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-05 20:06:15
合計ジャッジ時間 12,046 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 WA -
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"math"
)

func main() {
	var n, k, ans int
	_, _ = fmt.Scan(&n, &k)

	higher := n - k // 先頭より大きい数字の数
	if k > 1 {      // 先頭より小さい数がある
		ans++
	}

	if k == 1 { // 先頭より小さい数がない場合、先頭より大きい数から1つ最低にする数字を決める
		higher--
	}

	if higher > 0 { // Kより大きくて好きに並び替えられる数字がある
		ans += int(math.Pow(2, float64(higher))) - 1
	}

	fmt.Println(ans)
}
0