結果

問題 No.3474 Concat Decimal
コンテスト
ユーザー Today03
提出日時 2026-03-23 13:14:20
言語 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
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 1,603 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,684 ms
コンパイル使用メモリ 335,524 KB
実行使用メモリ 6,656 KB
最終ジャッジ日時 2026-03-23 13:14:31
合計ジャッジ時間 6,455 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define per(i,n) for(int i=(n)-1; i>=0; i--)
#define all(x) (x).begin(), (x).end()
bool chmax(auto& a, auto b) { return a<b ? a=b, 1: 0; }
bool chmin(auto& a, auto b) { return a>b ? a=b, 1: 0; }
using ll=long long; const int INF=1e9+10; const ll INFL=4e18;

#ifdef DEBUG
#include "./debug.hpp"
#else
#define debug(...)
#define print_line
#endif


using ull=unsigned long long; using lll=__int128_t;
constexpr lll operator ""_lll(ull x) { return static_cast<lll>(x); }
constexpr const lll INFLL=1_lll<<120;

istream& operator>>(istream& is, lll& x) {
	int c=is.peek();
	while(c==' '||c=='\n') is.get(), c=is.peek();
	bool neg=false;
	if(c=='-') neg=true, is.get();
	x=0;
	while(isdigit(is.peek())) x=x*10+is.get()-'0';
	if(neg) x=-x;
	return is;
}

ostream& operator<<(ostream& os, lll x) {
	if(x<0) os<<'-', x=-x;
	if(x==0) return os<<'0';
	string s;
	while(x>0) s+=x%10+'0', x/=10;
    reverse(all(s));
	return os<<s;
}

lll abs(lll x) { if (x<0) return -x; return x; }
lll gcd(lll a, lll b) {
    while(b) a%=b, swap(a,b);
    return a;
}

//------>8------------------------------------------->8------

void run() {
    int N; cin>>N;
    vector<lll> A(N);
    rep(i,N) cin>>A[i];

    lll ans=1;
    rep(i,N) if(i) {
        lll d=1;
        lll a=A[i];
        while(a) {
            a/=10;
            d*=10;
        }

        d/=gcd(A[i],d);
        ans=ans*d/gcd(ans,d);
    }

    cout<<ans<<'\n';
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int T; cin>>T;
    while(T--) run();
}
0