結果

問題 No.1372 Median of Submasks
ユーザー Zihua Wu
提出日時 2022-01-13 18:03:10
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 546 bytes
コンパイル時間 14,104 ms
コンパイル使用メモリ 401,368 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-17 08:16:44
合計ジャッジ時間 14,158 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

fn read_line() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line
}

fn read_items<T>() -> Vec<T>
where
    T: std::str::FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    return read_line()
        .trim()
        .split(" ")
        .filter(|&s| s.len() > 0)
        .map(|s| s.parse::<T>().unwrap())
        .collect();
}
fn main() {
    let n = read_items::<usize>()[0];

    let mut ans = 1;
    while ans * 2 <= n {
        ans *= 2;
    }

    println!("{}", ans);
}
0