結果

問題 No.3474 Concat Decimal
コンテスト
ユーザー yuusaan
提出日時 2026-03-20 17:28:31
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 1,094 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,722 ms
コンパイル使用メモリ 337,280 KB
実行使用メモリ 21,032 KB
最終ジャッジ日時 2026-03-20 20:55:24
合計ジャッジ時間 96,111 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample TLE * 1
other TLE * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int len(int x){//xの桁数
    int rt = 0;
    while(x>0){
        x /= 10;
        rt++;
    }
    return rt;
}

void solve(){
    //Pow2[i] = 2**i, Pow5[i] = 5**i, Pow10[i] = 10**i
    vector<ll> Pow2(11,1),Pow5(11,1),Pow10(11,1);
    for(int i = 1; i <= 10; i++){
        Pow2[i] = Pow2[i-1] * 2;
        Pow5[i] = Pow5[i-1] * 5;
        Pow10[i] = Pow10[i-1] * 10;
    }

    int N; cin >> N;
    vector<ll> A(N);
    for(int i = 0; i < N; i++)cin >> A[i];

    //i=2,3,4,...,N全てについて、A_i * 2**X * 5**Y >= 10^len(A_i)ならそれが答え
    for(int X = 0; X <= 10; X++){
        for(int Y = 0; Y <= 10; Y++){
            bool c = 1;
            for(int i = 0; i < N; i++){
                if(!(A[i] * Pow2[X] * Pow5[Y] >= Pow10[len(A[i])]))c = 0;
            }
            if(c){
                cout << Pow2[X] * Pow5[Y] << endl;
                return;
            }
        }
    }
}

int main(){
    int T; cin >> T;
    for(int testcase = 0; testcase < T; T++){
        solve();
    }
    return 0;
}
0