結果
| 問題 | No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1) | 
| コンテスト | |
| ユーザー |  沙耶花 | 
| 提出日時 | 2021-11-07 14:29:55 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 1,028 bytes | 
| コンパイル時間 | 5,029 ms | 
| コンパイル使用メモリ | 251,900 KB | 
| 最終ジャッジ日時 | 2025-01-25 14:32:32 | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 24 | 
ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001
int get(char c){
	//cout<<c<<endl;
	if(isdigit(c))return c-'0';
	else return 10 + c-'A';
}
int main(){
	
	string s;
	cin>>s;
	
	while(s.size()%3!=0)s.insert(s.begin(),'0');
	
	string t = "";
	while(s.size()!=0){
		string temp = s.substr(0,3);
		s.erase(s.begin(),s.begin()+3);
		int cur = 0;
		rep(i,temp.size()){
			cur *= 16;
			cur += get(temp[i]);
		}
		//cout<<cur<<endl;
		temp = "";
		rep(i,4){
			temp += (char)('0' + (cur%8));
			cur /= 8;
		}
		reverse(temp.begin(),temp.end());
		t += temp;
	}
//	cout<<t<<endl;
	while(t.size()>0 && t[0]=='0')t.erase(t.begin());
	
	vector<int> c(8,0);
	rep(i,t.size())c[t[i]-'0']++;
	
	int M = 0;
	rep(i,8)M = max(M,c[i]);
	//cout<<M<<endl;
	
	bool f = false;
	rep(i,8){
		if(c[i]==M){
			if(f)cout<<' ';
			cout<<i;
			f = true;
		}
	}
	cout<<endl;
		
	
	return 0;
}
            
            
            
        