結果

問題 No.642 Two Operations No.1
ユーザー Daigo HIROOKA
提出日時 2018-06-19 00:14:01
言語 Java
(openjdk 23)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 306 bytes
コンパイル時間 3,265 ms
コンパイル使用メモリ 74,112 KB
実行使用メモリ 41,648 KB
最終ジャッジ日時 2024-06-30 17:08:45
合計ジャッジ時間 5,873 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class No001{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int count = 0;
		while(true){
			if(N == 1) break;
			
			if(N%2 == 0){
				N /= 2;
			}else{
				N++;
			}
			count++;
		}
		System.out.println(count);
	}
}
0