結果

問題 No.164 ちっちゃくないよ!!
ユーザー 777yuuki12323777yuuki12323
提出日時 2017-04-07 22:54:52
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,138 bytes
コンパイル時間 492 ms
コンパイル使用メモリ 64,348 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-23 02:25:26
合計ジャッジ時間 1,310 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

 #include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <map>


typedef long long ll;
#define fi first
#define se second

using namespace std;

int V[1123][15];
int N;
ll big[15];
ll num[15];
int k[15];
ll d;
ll ans = 5123456789012345678;


int main(){
  
  int i;
  int j;
  
  fill( big, big+15, 0 );
  fill( V[0], V[1123], 0 );
  fill( num, num+15, 0 );
  
  string str;
  
  cin>>N;
  
  for( i = 0; i < N; i++ ){
    cin>>str;
    j = (int) str.size();
    k[i] = 0;
    while( j > 0 ){
      j--;
      if( str[j] <= '9' && str[j] >= '0' ){
        V[i][k[i]] = str[j] - '0';
        k[i]++;
      }
      else if( str[j] <= 'Z' && str[j] >= 'A' ){
        V[i][k[i]] = str[j] - 'A' + 10;
        k[i]++;
      }
    }
  }
  
  for( i = 0; i < N; i++ ){
    for( j = 0; j < k[i]; j++ ){
      big[i] = max( (int)big[i], V[i][j] );
    }
    big[i]++;
  }
  
  for( i = 0; i < N; i++ ){
    d = 1;
    for( j = 0; j < k[i]; j++ ){
      if( j ) d *= big[i];
      num[i] += d*(ll)V[i][j];
    }
  }
  
  for( i = 0; i < N; i++ ){
    ans = min( ans, num[i] );
  }
  
  cout<<ans<<endl;
  
  return 0;
}
0