結果

問題 No.164 ちっちゃくないよ!!
ユーザー 777yuuki12323777yuuki12323
提出日時 2017-04-08 00:40:01
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,139 bytes
コンパイル時間 459 ms
コンパイル使用メモリ 65,232 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-23 03:18:14
合計ジャッジ時間 1,716 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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[1123];
ll num[1123];
int k[1123];
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]++;
      }
      else{ break; }
    }
  }
  
  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];
    }
    
    ans = min( ans, num[i] );
    
  }
  
  cout<<ans<<endl;
  
  return 0;
}
0