結果

問題 No.736 約比
ユーザー ynpppynppp
提出日時 2023-11-16 09:39:04
言語 Rust
(1.77.0)
結果
RE  
実行時間 -
コード長 2,277 bytes
コンパイル時間 1,025 ms
コンパイル使用メモリ 189,688 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-11-16 09:39:09
合計ジャッジ時間 3,066 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 1 ms
6,676 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 1 ms
6,676 KB
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 1 ms
6,676 KB
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 AC 1 ms
6,676 KB
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
testcase_51 RE -
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
testcase_55 RE -
testcase_56 RE -
testcase_57 RE -
testcase_58 RE -
testcase_59 RE -
testcase_60 RE -
testcase_61 RE -
testcase_62 AC 1 ms
6,676 KB
testcase_63 AC 1 ms
6,676 KB
testcase_64 AC 1 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(dead_code, unused_variables, unused_macros, unused_imports)]

use std::ops::{Div, Mul, Rem};
fn gcd<T>(a: T, b: T) -> T
where
    T: Eq + Default + Clone + Copy + Rem<Output = T>,
{
    if b == T::default() {
        a
    } else {
        gcd(b, a % b)
    }
}

fn main() {
    input!(n:usize, a:[i32; n]);

    let divisor = a.iter().skip(2).fold(gcd(a[0], a[1]), |d, &ai| gcd(d, ai));
    let x: Vec<_> = a.into_iter().map(|ai| (ai / divisor).to_string()).collect();
    println!("{}", x.join(":"));
}

mod xxx {
    // https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
    #[macro_export]
    macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        input_inner!{$s, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
    #[macro_export]
    macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

    #[macro_export]
    macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, bits)=>{
        u64::from_str_radix(&$next(), 2).expect("Parse error")
    };

    ($next:expr, hexs)=>{
        u64::from_str_radix(&$next(), 16).expect("Parse error")
    };


    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
}
0