結果

問題 No.3474 Concat Decimal
コンテスト
ユーザー 👑 Mizar
提出日時 2026-03-20 21:43:28
言語 Rust
(1.93.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 1,068 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 8,791 ms
コンパイル使用メモリ 205,900 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-20 21:43:41
合計ジャッジ時間 3,077 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// -*- coding:utf-8-unix -*-

#[allow(unused_imports)]
use std::io::{BufReader, BufWriter, Write, stdin, stdout, stderr};
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use num::*;
#[allow(unused_imports)]
use proconio::input;
#[allow(unused_imports)]
use itertools::*;

#[allow(dead_code)]
trait Change { fn chmax(&mut self, x: Self); fn chmin(&mut self, x: Self); }
impl<T: PartialOrd> Change for T {
    fn chmax(&mut self, x: T) { if *self < x { *self = x; } }
    fn chmin(&mut self, x: T) { if *self > x { *self = x; } }
}

fn main() {
    input! {
        t: usize,
    }
    for _ in 0..t {
        input! {
            n: usize,
            a: [u32; n],
        }
        let mut res = 1u64;
        for ae in a[1..].iter().map(|&x| x as u64) {
            let alen = ae.to_string().len() as u32;
            let b = 10u64.pow(alen) / 10u64.pow(alen).gcd(&ae);
            res = res.lcm(&b);
        }
        println!("{}", res);
    }
}
0