結果

問題 No.2233 Average
ユーザー ixTL255ixTL255
提出日時 2023-03-24 10:54:59
言語 Rust
(1.77.0)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 805 bytes
コンパイル時間 2,197 ms
コンパイル使用メモリ 165,540 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 20:00:56
合計ジャッジ時間 6,310 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 0 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 90 ms
4,348 KB
testcase_09 AC 138 ms
4,348 KB
testcase_10 AC 84 ms
4,348 KB
testcase_11 AC 82 ms
4,348 KB
testcase_12 AC 71 ms
4,348 KB
testcase_13 AC 17 ms
4,348 KB
testcase_14 AC 76 ms
4,348 KB
testcase_15 AC 104 ms
4,348 KB
testcase_16 AC 30 ms
4,348 KB
testcase_17 AC 38 ms
4,348 KB
testcase_18 AC 156 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io;

fn solve() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let mut a: usize = itr.next().unwrap().parse().unwrap();
    let mut b: usize = itr.next().unwrap().parse().unwrap();
    let mut c: usize = itr.next().unwrap().parse().unwrap();
    let k: usize = itr.next().unwrap().parse().unwrap();

    for _ in 0..k {
        if a == b && b == c { break; }
        
        let x = (b + c) / 2;
        let y = (c + a) / 2;
        let z = (a + b) / 2;
        a = x;
        b = y;
        c = z;     
    }

    println!("{}", a + b + c)
}

fn main() {
    let mut t = String::new();
    io::stdin().read_line(&mut t).ok();
    let t: usize = t.trim().parse().unwrap();

    for _ in 0..t {
        solve();
    }
}
0