結果
問題 | No.164 ちっちゃくないよ!! |
ユーザー |
![]() |
提出日時 | 2017-09-27 06:42:08 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,148 bytes |
コンパイル時間 | 692 ms |
コンパイル使用メモリ | 80,892 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-15 17:01:24 |
合計ジャッジ時間 | 1,041 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <cstring> #include <math.h> #include <cmath> #include <limits.h> #include <map> #include <set> #include <queue> #include <algorithm> #include <functional> #include <stdio.h> using namespace std; long long MOD = 1000000007; int main() { long long ans = LLONG_MAX; int N; cin >> N; for ( int i = 0; i < N; i++ ) { string S; cin >> S; int m = 0; for ( int j = 0; j < S.length(); j++ ) { if ( isdigit(S[j]) ) { m = max( m, S[j] - '0' ); } else { m = max( m, S[j]-'A'+10 ); } } m++; long long a = 0; for ( int j = S.length()-1; j >= 0 ; j-- ) { long long x = 1; for ( int k = 0; k < S.length()-1-j; k++ ) { x *= m; } if ( isdigit(S[j]) ) { x *= S[j] - '0'; } else { x *= S[j] - 'A' + 10; } a += x; } ans = min( ans, a ); } cout << ans << endl; return 0; }