結果

問題 No.3276 Make Smaller Popcount
ユーザー urectanc
提出日時 2025-09-19 21:45:48
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 452 bytes
コンパイル時間 11,853 ms
コンパイル使用メモリ 400,652 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-09-19 21:46:04
合計ジャッジ時間 15,009 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::input;
use std::io::Write;

fn main() {
    input! { t: usize }
    let mut output = std::io::BufWriter::new(std::io::stdout().lock());

    for _ in 0..t {
        let ans = solve();
        writeln!(output, "{}", ans.unwrap_or(!0) as isize).unwrap();
    }
}

fn solve() -> Option<usize> {
    input! { n: usize }
    if n.count_ones() == 1 {
        None
    } else {
        let m = n.next_power_of_two();
        Some(m - n)
    }
}
0