結果
| 問題 |
No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1)
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2021-11-05 23:58:57 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 1,042 bytes |
| コンパイル時間 | 2,109 ms |
| コンパイル使用メモリ | 199,288 KB |
| 最終ジャッジ日時 | 2025-01-25 13:59:31 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
string s;
cin>>s;
int n=s.size();
string t="0000";
rep(i,n){
if(s[i]=='A') t+="1010";
else if(s[i]=='B') t+="1011";
else if(s[i]=='C') t+="1100";
else if(s[i]=='D') t+="1101";
else if(s[i]=='E') t+="1110";
else if(s[i]=='F') t+="1111";
}
reverse(ALL(t));
int m=(4*n+2)/3;
vector<int> A(8);
for(int i=0;i<m;i++){
string u=t.substr(i*3,3);
if(u=="000") A[0]++;
else if(u=="100") A[1]++;
else if(u=="010") A[2]++;
else if(u=="110") A[3]++;
else if(u=="001") A[4]++;
else if(u=="101") A[5]++;
else if(u=="011") A[6]++;
else if(u=="111") A[7]++;
}
int ma=0;
rep(i,8) ma=max(ma,A[i]);
vector<int> B;
rep(i,8){
if(A[i]==ma) B.push_back(i);
}
rep(i,B.size()){
if(i) cout<<" ";
cout<<B[i];
}
cout<<endl;
return 0;
}
umezo