結果

問題 No.642 Two Operations No.1
ユーザー YamaKasa
提出日時 2018-09-30 18:25:15
言語 Java
(openjdk 23)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 318 bytes
コンパイル時間 1,983 ms
コンパイル使用メモリ 74,404 KB
実行使用メモリ 54,208 KB
最終ジャッジ日時 2024-10-12 09:16:14
合計ジャッジ時間 5,053 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		scan.close();
		int cnt = 0;
		while(1 < N) {
			if(N % 2 == 1) {
				N++;
				cnt++;
			}else {
				N /= 2;
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}
0