結果
| 問題 | 
                            No.642 Two Operations No.1
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-03-22 23:44:39 | 
| 言語 | Rust  (1.83.0 + proconio)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 434 bytes | 
| コンパイル時間 | 18,213 ms | 
| コンパイル使用メモリ | 378,520 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-26 05:41:28 | 
| 合計ジャッジ時間 | 19,395 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 WA * 9 | 
ソースコード
use std::io::*;
fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let mut x = 1;
    let mut ans = 0;
    while x * 2 <= n {
        ans += 1;
        x <<= 1;
    }
    if x != n {
        ans += x - (n + 1) / 2 + 1;
        ans += n & 1;
    }
    println!("{}", ans);
}