// No.164 ちっちゃくないよ!! // https://yukicoder.me/problems/no/164 // #include #include #include #include using namespace std; unsigned long long int solve(vector &V); int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); unsigned int N; cin >> N; vector V(N); for (auto i = 0; i < N; ++i) cin >> V[i]; unsigned long long ans = solve(V); cout << ans << endl; } unsigned long long int solve(vector &V) { unsigned long long ans = pow(2, 63); for (string v: V) { size_t idx; size_t l = v.size(); for (auto i = 0; i < l; ++i) { if (v[i] == '0') v[i] = ' '; else break; } for (int base = 2; base <= 36; ++base) { try { unsigned long long t = stoull(v, &idx, base); if (idx == l) { ans = min(ans, t); break; } } catch (invalid_argument& e){ ; } } } return ans; }