結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー cra77756176
提出日時 2022-11-17 01:35:39
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 434 bytes
コンパイル時間 12,395 ms
コンパイル使用メモリ 383,568 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-17 19:51:40
合計ジャッジ時間 13,119 ms
ジャッジサーバーID
(参考情報)
judge2 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{self, BufRead};

fn main() {
    io::stdin().lock().lines().for_each(|l| {
        let input = l
            .unwrap()
            .split(' ')
            .map(|n| n.parse::<usize>().unwrap())
            .collect::<Vec<_>>();

        let mut power = 1;
        let mut answer = 0;

        while power < input[0] {
            power <<= 1;
            answer += 1;
        }

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