結果

問題 No.1423 Triangle of Multiples
ユーザー fukafukatanifukafukatani
提出日時 2021-04-04 11:36:49
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 1,228 bytes
コンパイル時間 1,030 ms
コンパイル使用メモリ 150,756 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-27 07:12:39
合計ジャッジ時間 1,984 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;
use std::ops::Bound::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let t = read::<usize>();
    for _ in 0..t {
        let v = read_vec::<i64>();
        let mut vv = v
            .iter()
            .enumerate()
            .map(|(i, &x)| (x, i))
            .collect::<Vec<_>>();
        vv.sort();
        let coef = vv[2].0 / vv[0].0;
        debug!(coef);
        vv[0].0 *= coef;

        let mut answers = vec![0; 3];
        for (x, i) in vv {
            answers[i] = x;
        }
        for ans in answers {
            print!("{} ", ans);
        }
        println!("");
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
0