結果

問題 No.2241 Reach 1
ユーザー ixTL255
提出日時 2023-03-12 21:51:21
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 364 bytes
コンパイル時間 11,960 ms
コンパイル使用メモリ 392,668 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-18 07:15:43
合計ジャッジ時間 12,509 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

fn is_power_of_two(n: isize) -> bool {
    n > 0 && (n & (n - 1)) == 0
} 

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let n: isize = n.trim().parse().unwrap();

    println!("{}",
        if is_power_of_two(n) {
            1
        } else if n % 2 == 0 {
            3
        } else {
            2
        });
}
0