結果
問題 | No.164 ちっちゃくないよ!! |
ユーザー |
|
提出日時 | 2017-05-07 20:10:36 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 782 bytes |
コンパイル時間 | 657 ms |
コンパイル使用メモリ | 61,276 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-14 14:51:01 |
合計ジャッジ時間 | 1,201 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
#include <algorithm> #include <iostream> using namespace std; int main(int argc, const char* argv[]) { int N; cin >> N; string V[N]; int bases[N]; for (auto&& v : V) cin >> v; auto c2v = [](char c) { int v = 0; if ('0' <= c && c <= '9') v = c - '0'; if ('A' <= c && c <= 'Z') v = 10 + c - 'A'; return v; }; auto s2base = [&](string s) { int maxval = 0; for (auto&& c : s) maxval = max(c2v(c), maxval); return maxval + 1; }; for (int i = 0; i < N; i++) bases[i] = s2base(V[i]); auto conv = [&](string s, int base) { uint64_t sum = 0; for (auto&& c : s) sum = sum * base + c2v(c); return sum; }; uint64_t RET[N]; for (int i = 0; i < N; i++) RET[i] = conv(V[i], bases[i]); sort(RET, &RET[N]); cout << RET[0] << endl; return 0; }