結果

問題 No.1423 Triangle of Multiples
ユーザー tonyu0tonyu0
提出日時 2021-03-12 21:53:39
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 648 bytes
コンパイル時間 12,536 ms
コンパイル使用メモリ 406,892 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-14 12:16:54
合計ジャッジ時間 13,540 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::*;
fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        return a;
    }
    gcd(b, a % b)
}
fn lcm(a: u64, b: u64) -> u64 {
    a / gcd(a, b) * b
}
fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let t: usize = itr.next().unwrap().parse().unwrap();
    for _ in 0..t {
        let a: u64 = itr.next().unwrap().parse().unwrap();
        let b: u64 = itr.next().unwrap().parse().unwrap();
        let c: u64 = itr.next().unwrap().parse().unwrap();
        let l = lcm(a, lcm(b, c));
        println!("{} {} {}", l, l, l);
    }
}
0