結果

問題 No.164 ちっちゃくないよ!!
ユーザー maine_honzukimaine_honzuki
提出日時 2020-06-01 17:17:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 816 bytes
コンパイル時間 1,364 ms
コンパイル使用メモリ 167,676 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 18:48:09
合計ジャッジ時間 1,890 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0