結果

問題 No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1)
ユーザー scrappyscrappy
提出日時 2022-10-11 10:33:31
言語 Go
(1.22.1)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 531 bytes
コンパイル時間 15,816 ms
コンパイル使用メモリ 212,680 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-07 12:03:41
合計ジャッジ時間 15,007 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

package main

import (
	"fmt"
)

func main() {
	var N string
	fmt.Scan(&N)

	hh := make([]int, 8)

	d := 0
	i3 := 0
	for i := len(N) - 1; i >= 0; i-- {
		d += (10 + int(N[i]-'A')) << (4 * i3)

		i3++
		if i3 >= 3 {
			i3 = 0
			for j := 0; j < 4; j++ {
				hh[d%8]++
				d /= 8
			}
		}
	}
	for d > 0 {
		hh[d%8]++
		d /= 8
	}

	maxh := 0
	for o := 0; o < 8; o++ {
		if hh[o] > maxh {
			maxh = hh[o]
		}
	}

	blank := ""
	for o := 0; o < 8; o++ {
		if hh[o] == maxh {
			fmt.Print(blank, o)
			blank = " "
		}
	}
	fmt.Println()
}
0