結果
| 問題 | No.3474 Concat Decimal |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-03-20 17:52:23 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 422 ms / 2,000 ms |
| コード長 | 1,145 bytes |
| 記録 | |
| コンパイル時間 | 2,749 ms |
| コンパイル使用メモリ | 337,424 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2026-03-20 20:55:52 |
| 合計ジャッジ時間 | 6,932 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 27 |
ソースコード
#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(コード上は1,2,...,N-1)全てについて、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 = 1; i < N; i++){
if(!(A[i] * Pow2[X] * Pow5[Y] % Pow10[len(A[i])] == 0))c = 0;
}
if(c){
cout << Pow2[X] * Pow5[Y] << endl;
return;
}
}
}
return;
}
int main(){
int T; cin >> T;
for(int testcase = 0; testcase < T; testcase++){
solve();
}
return 0;
}