結果

問題 No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1)
ユーザー umezoumezo
提出日時 2021-11-05 23:58:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,042 bytes
コンパイル時間 2,061 ms
コンパイル使用メモリ 199,892 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 08:42:01
合計ジャッジ時間 2,728 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#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;
}
0