結果

問題 No.164 ちっちゃくないよ!!
ユーザー kpinkcatkpinkcat
提出日時 2023-11-03 19:24:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,208 bytes
コンパイル時間 2,298 ms
コンパイル使用メモリ 204,620 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-11-03 19:24:13
合計ジャッジ時間 3,106 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<math.h>
#include<bitset>
using ll = long long;
using namespace std;


int main(){
    int n;
    ll mans = 1e18;
    cin >> n;
    vector<char> v(36);
    v =  {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
                        'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
                        'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
                        'U', 'V', 'W', 'X', 'Y', 'Z'};
    for (int k = 0; k < n; k++){
        int base = 0, maxb = 0;
        ll ans = 0;
        string s;
        cin >> s;
        for (int i = 0; i < s.size(); i++) {
            for (int j = 0; j < 36; j++){
                if (s[i] == v[j]) maxb = max(maxb, j);
            }
        }
        base = ++maxb;
        for (ll i = s.size()-1; i >= 0; i--) {
            for (ll j = 0; j < 36; j++){
                if (s[i] == v[j]) {
                    ans += j*pow(base, (s.size()-i-1));
                    break;
                }
            }
        }
        mans = min(mans, ans);
    }
    cout << mans << endl;
}
0