結果

問題 No.164 ちっちゃくないよ!!
ユーザー zangezange
提出日時 2015-03-13 21:39:33
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 817 bytes
コンパイル時間 472 ms
コンパイル使用メモリ 52,924 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-03 17:07:20
合計ジャッジ時間 1,099 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <limits.h>
using namespace std;

int main() {
    string s;
    int i, j, base, n, N;
    char max;
    long long num, p, sum, min = LLONG_MAX;
    int list[1000];
    cin >> N;
    for (j = 0; j < N; j++) {
        sum = 0;
        p = 1;
        cin >> s;
        n = s.size();
        max = s[0];

        for (i = 0; i < n; i++) {

            if (max < s[i]) max = s[i];
            if (s[i] >= '0' && s[i] <= '9') list[n - 1 - i] = (int)s[i] - 48;
            else list[n - 1 - i] = (int)s[i] - 55;
        }

        if (max < 'A') base = (int)max - 48 + 1;
        else base = (int)max - 55 + 1;

        for (i = 0; i < n; i++) {
            sum += list[i] * p;
            p *= base;
        }

        if (sum < min) min = sum;
    }

    cout << min << endl;

    return 0;
}
0