結果
問題 | No.164 ちっちゃくないよ!! |
ユーザー |
![]() |
提出日時 | 2020-06-01 17:17:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 816 bytes |
コンパイル時間 | 1,765 ms |
コンパイル使用メモリ | 168,048 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-22 00:43:24 |
合計ジャッジ時間 | 2,229 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
#include <bits/stdc++.h> using namespace std; long long intpow(long long a, long long b) { long long ans = 1; while (b) { if (b & 1) ans *= a; a *= a; b /= 2; } return ans; } int main() { int N; cin >> N; long long ans = intpow(36, 12); auto f = [](char c) { if (c >= '0' && c <= '9') return (int)c - '0'; else return 10 + c - ('A'); }; while (N--) { string V; cin >> V; int MAX = 0; for (auto& c : V) { c = f(c); MAX = max(MAX, (int)c); } MAX++; long long res = 0; for (auto& c : V) { res *= MAX; res += c; } ans = min(ans, res); } cout << ans << endl; }