結果

問題 No.566 だいたい完全二分木
ユーザー tsuchinagatsuchinaga
提出日時 2019-03-07 12:50:16
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 429 bytes
コンパイル時間 13,149 ms
コンパイル使用メモリ 205,444 KB
実行使用メモリ 8,420 KB
最終ジャッジ日時 2023-09-05 19:23:40
合計ジャッジ時間 14,325 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"math"
	"strings"
)

func main() {
	var k int
	_, _ = fmt.Scan(&k)
	l := int(math.Pow(2, float64(k))) - 1
	s := l - 3*k

	fmt.Println(s)
	a := ""
	if s < 1 {
		for i := 1; i <= l; i++ {
			a += fmt.Sprintf("%d ", i)
		}
	} else {
		for i := s; i >= 1; i-- {
			a += fmt.Sprintf("%d ", i)
		}
		for i := s + 1; i <= l; i++ {
			a += fmt.Sprintf("%d ", i)
		}
	}
	fmt.Println(strings.Trim(a, " "))
}
0