結果

問題 No.2647 [Cherry 6th Tune A] Wind
ユーザー ktmtr005
提出日時 2024-02-24 13:43:00
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 806 bytes
コンパイル時間 13,944 ms
コンパイル使用メモリ 387,264 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-09-29 10:01:36
合計ジャッジ時間 14,838 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

fn read() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).expect("Failed to read line.");
    buf.trim().to_string()
}

fn main() {
    let t = read().parse::<usize>().unwrap();

    for _i in 0..t {
        let (_d, a) = {
            let line = read().split_whitespace().map(|s| s.parse().unwrap()).collect::<Vec<u64>>();
            let mut i = line.iter();
            (*i.next().unwrap(), *i.next().unwrap())
        };
        let x = read().split_whitespace().map(|s| s.parse().unwrap()).collect::<Vec<u64>>();
        let mut ans = Vec::new();
        for i in x {
            let wind = i / a + i % a * 2 / a;
            ans.push(wind);
        }
        println!("{}", ans.iter().map(std::string::ToString::to_string).collect::<Vec<_>>().join(" "))
    }
}
0