結果

問題 No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1)
ユーザー scrappy
提出日時 2022-10-11 10:33:31
言語 Go
(1.23.4)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 531 bytes
コンパイル時間 15,281 ms
コンパイル使用メモリ 234,960 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-25 06:10:17
合計ジャッジ時間 14,889 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

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