結果
| 問題 |
No.164 ちっちゃくないよ!!
|
| コンテスト | |
| ユーザー |
not_522
|
| 提出日時 | 2015-07-28 10:18:59 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 976 bytes |
| コンパイル時間 | 1,158 ms |
| コンパイル使用メモリ | 159,076 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-13 14:16:32 |
| 合計ジャッジ時間 | 1,654 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
template<typename T> inline T toInteger(const string&);
template<> inline int toInteger<int>(const string& s) {
return stoi(s);
}
template<> inline long toInteger<long>(const string& s) {
return stol(s);
}
template<> inline long long toInteger<long long>(const string& s) {
return stoll(s);
}
template<typename T = long long> inline T toInteger(const string& s, int n) {
T res = 0;
for (char c : s) {
if (isdigit(c)) res = res * n + c - '0';
else if (isalpha(c)) res = res * n + tolower(c) - 'a' + 10;
}
return s[0] == '-' ? -res : res;
}
int main() {
int n;
cin >> n;
long long res = numeric_limits<long long>::max();
for (int i = 0; i < n; ++i) {
string v;
cin >> v;
int mx = 0;
for (char c : v) {
if (isdigit(c)) mx = max(mx, c - '0' + 1);
else if (isalpha(c)) mx = max(mx, c - 'A' + 11);
}
res = min(res, toInteger(v, mx));
}
cout << res << endl;
}
not_522