結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
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

	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