結果
| 問題 | No.736 約比 | 
| コンテスト | |
| ユーザー |  cra77756176 | 
| 提出日時 | 2022-12-23 21:01:09 | 
| 言語 | Rust (1.83.0 + proconio) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 553 bytes | 
| コンパイル時間 | 13,764 ms | 
| コンパイル使用メモリ | 384,248 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-18 04:15:34 | 
| 合計ジャッジ時間 | 16,197 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 65 | 
ソースコード
const fn gcd(a: u64, b: u64) -> u64 {
    let mut x = (a, b);
    while x.1 > 0 {
        x = (x.1, x.0 % x.1);
    }
    x.0
}
fn main() {
    let mut xx = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut xx).ok();
    let xx: Vec<u64> = xx.split_whitespace().skip(1).flat_map(str::parse).collect();
    let gcd = xx.iter().fold(xx[0], |acc, &x| gcd(acc, x));
    println!(
        "{}",
        xx.iter()
            .map(|&n| (n / gcd).to_string())
            .collect::<Vec<String>>()
            .join(":")
    );
}
            
            
            
        