結果

問題 No.164 ちっちゃくないよ!!
ユーザー eve__fuyukieve__fuyuki
提出日時 2018-03-15 06:17:03
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 791 bytes
コンパイル時間 481 ms
コンパイル使用メモリ 52,416 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-08-21 04:11:19
合計ジャッジ時間 1,317 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<string>
using namespace std;
int main(){
    int N,i;
    long long j,num,max,base,min = 5e18;
    string S;
    long long nums[12];
    cin >> N;
    for(i=0;i<N;i++){
        cin >> S;
        max = 2;
        for(int k=0;k<12;k++) nums[k] = 0;
        for(int k=0;k<S.length();k++){
            if((int)S[k] <= 57){
                nums[k] = (int)S[k] - 48;
            }
            else{
                nums[k] = (int)S[k] - 55;
            }
            if(nums[k] > max) max = nums[k];
        }
        max++;
        base = max;
        num = nums[S.length()-1];
        for(int k=S.length()-2;k>=0;k--){
            num += base*nums[k];
            base *= max;
        }
        if(min > num) min = num;
    }
    cout << min << endl;
    return 0;
}
0