結果
| 問題 |
No.164 ちっちゃくないよ!!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-09 21:18:05 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 711 bytes |
| コンパイル時間 | 553 ms |
| コンパイル使用メモリ | 66,416 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-28 02:50:51 |
| 合計ジャッジ時間 | 1,064 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 11 |
ソースコード
#include<iostream>
using namespace std;
typedef long long ll;
ll getnum(int digit, string s){
ll res = 0;
ll base = 1;
for(int i = s.size()-1; i >= 0; i--){
char x = s[i];
if(x <= '9') res += ll(x-'0')*base;
else res += ll(x-'A'+10)*base;
base *= ll(digit);
}
return res;
}
int main(){
int n;
cin >> n;
string s;
ll ans = 0;
while(n-- > 0){
cin >> s;
char m = '0';
for(char x : s){
m = max(m,x);
}
ll now;
if(m <= '9') now = getnum(m-'0'+1,s);
else now = getnum(m-'A'+11,s);
ans = min(ans,now);
}
cout << ans << endl;
return 0;
}