結果

問題 No.2647 [Cherry 6th Tune A] Wind
ユーザー どららどらら
提出日時 2024-03-20 02:15:49
言語 Rust
(1.77.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 1,093 bytes
コンパイル時間 668 ms
コンパイル使用メモリ 176,764 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-20 02:15:59
合計ジャッジ時間 1,552 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 3 ms
6,676 KB
testcase_09 AC 3 ms
6,676 KB
testcase_10 AC 4 ms
6,676 KB
testcase_11 AC 4 ms
6,676 KB
testcase_12 AC 4 ms
6,676 KB
testcase_13 AC 1 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(non_snake_case)]
use std::io;

fn solve() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let D = it.next().unwrap().parse::<i32>().unwrap();
    let A = it.next().unwrap().parse::<i64>().unwrap();

    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let mut X = Vec::<i64>::new();
    for _ in 0..D {
        let x = it.next().unwrap().parse::<i64>().unwrap();
        X.push(x);
    }

    let mut ret = Vec::<i64>::new();
    for x in X {
        let a = x / A;
        let b = x % A;
        let val = a + (2 * b >= A) as i64;
        ret.push(val);
    }

    for i in 0..ret.len() {
        if i > 0 {
            print!(" ");
        }
        print!("{}", ret[i]);
    }
    println!();
}

fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let T = it.next().unwrap().parse::<i64>().unwrap();

    for _ in 0..T {
        solve()
    }
}
0