結果

問題 No.164 ちっちゃくないよ!!
ユーザー ngtkana
提出日時 2020-03-24 10:32:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 735 bytes
コンパイル時間 2,944 ms
コンパイル使用メモリ 194,796 KB
最終ジャッジ日時 2025-01-09 10:00:46
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 WA * 6
権限があれば一括ダウンロードができます

ソースコード

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 base=0;
    for(auto&&s:a)for(char c:s){
        cmx(base,cal(c));
    }
    base++;
    lint ans=std::numeric_limits<lint>::max();
    for(auto&&s:a){
        lint now=0;
        for(char c:s){
            now=base*now+cal(c);
        }
        cmn(ans,now);
    }
    std::cout<<ans<<'\n';
}
0