結果

問題 No.642 Two Operations No.1
ユーザー ixTL255ixTL255
提出日時 2023-01-02 20:05:46
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 273 bytes
コンパイル時間 11,104 ms
コンパイル使用メモリ 383,360 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-27 01:14:34
合計ジャッジ時間 11,964 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
	let mut n = String::new();
	std::io::stdin().read_line(&mut n).ok();
	let mut n: i32 = n.trim().parse().unwrap();
	let mut ans: i32 = 0;
	while 1 < n {
		if n % 2 == 1 {
			n += 1;
			ans += 1;
		} else {
			n >>= 1;
			ans += 1;
		}
	}
	println!("{}", ans);
}
0