結果

問題 No.164 ちっちゃくないよ!!
ユーザー ngtkanangtkana
提出日時 2020-03-24 10:37:06
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 741 bytes
コンパイル時間 1,953 ms
コンパイル使用メモリ 200,968 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-30 05:12:45
合計ジャッジ時間 2,750 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using lint=long long;
void cmx(lint&x,lint y){if(x<y)x=y;}
void cmn(lint&x,lint y){if(x>y)x=y;}
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint n;std::cin>>n;
    std::vector<std::string>a(n);
    for(auto&&s:a)std::cin>>s;
    auto cal=[&](char c){
        return std::isdigit(c)?c-'0':c-'A'+10;
    };
    lint ans=std::numeric_limits<lint>::max();
    for(auto&&s:a){
        lint base=0;
        for(char c:s){
            cmx(base,cal(c));
        }
        base++;
        lint now=0;
        for(char c:s){
            now=base*now+cal(c);
        }
        cmn(ans,now);
    }
    std::cout<<ans<<'\n';
}
0