結果

問題 No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1)
ユーザー Josué RoblesJosué Robles
提出日時 2021-11-05 22:16:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 746 bytes
コンパイル時間 671 ms
コンパイル使用メモリ 65,704 KB
実行使用メモリ 10,020 KB
最終ジャッジ日時 2024-11-06 13:10:18
合計ジャッジ時間 4,283 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8 TLE * 1 -- * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie();
    cout.tie();
    unsigned long long total=0, temp=1, maximo=0;
    string palabra;
    long long int lista[8]={};
    cin>>palabra;
    for(int i=palabra.size()-1; i>=0; --i){
      char letra=palabra[i];
      total+=(letra-55)*temp;
      temp*=16;
    }
    temp=1;
    for(temp=1; temp<total; temp*=8);
    if(temp>total){
      temp/=8;
    }
    for(int i; temp>0 && total>0; temp/=8){
      i=total/temp;
      total%=temp;
      if(i>0){
        lista[i-1]++;
      }
      if(maximo<lista[i-1]){
        maximo=lista[i-1];
      }
    }
    for(int i=0; i<8; ++i){
      if(lista[i]==maximo){
        cout<<i+1<<' ';
      }
    }
}
0