結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー tsuchinagatsuchinaga
提出日時 2019-05-21 14:26:48
言語 Go
(1.21.3)
結果
MLE  
実行時間 -
コード長 331 bytes
コンパイル時間 11,778 ms
コンパイル使用メモリ 228,992 KB
実行使用メモリ 645,352 KB
最終ジャッジ日時 2023-10-17 10:37:15
合計ジャッジ時間 24,179 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import "fmt"

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

	if n == 1 {
		fmt.Println(0)
	} else {
		nums := map[int]int{2: 1}
		for i := 2; i <= n; i++ {
			if i+i-1 == n || i+i == n {
				fmt.Println(nums[i] + 1)
				return
			}
			nums[i+i-1] = nums[i] + 1
			nums[i+i] = nums[i] + 1
			delete(nums, i)
		}
	}
}
0