結果
| 問題 | No.1298 OR XOR | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-01-17 00:15:35 | 
| 言語 | Rust (1.83.0 + proconio) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 2,000 ms | 
| コード長 | 925 bytes | 
| コンパイル時間 | 21,680 ms | 
| コンパイル使用メモリ | 377,984 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-23 12:39:54 | 
| 合計ジャッジ時間 | 14,830 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 13 | 
ソースコード
#[macro_export]
macro_rules! setup {
    { mut $input:ident: SplitWhitespace $(,)? } => {
        use std::io::Read;
        let mut buf = String::new();
        std::io::stdin().read_to_string(&mut buf).ok();
        let mut $input = buf.split_whitespace();
    };
}
#[macro_export]
macro_rules! parse_next {
    ($str_iter:expr) => {
        $str_iter.next().unwrap().parse().ok().unwrap()
    };
}
fn main() {
    setup! { mut input: SplitWhitespace };
    let n: usize = parse_next!(input);
    let digits = {
        let mut c = 0;
        let mut n = n;
        while n > 0 {
            c += 1;
            n >>= 1;
        }
        c as usize
    };
    let ans = (|| {
        let a = 1 << (digits - 1);
        let b = n ^ a;
        let c = n;
        match b {
            0 => format!("{} {} {}", -1, -1, -1),
            _ => format!("{} {} {}", a, b, c),
        }
    })();
    println!("{}", ans);
}
            
            
            
        