結果

問題 No.642 Two Operations No.1
ユーザー Daigo HIROOKADaigo HIROOKA
提出日時 2018-06-19 00:14:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 306 bytes
コンパイル時間 3,038 ms
コンパイル使用メモリ 71,564 KB
実行使用メモリ 56,312 KB
最終ジャッジ日時 2023-09-13 07:00:49
合計ジャッジ時間 5,933 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
56,044 KB
testcase_01 AC 118 ms
55,776 KB
testcase_02 AC 119 ms
56,260 KB
testcase_03 AC 119 ms
55,908 KB
testcase_04 AC 117 ms
55,944 KB
testcase_05 AC 118 ms
56,032 KB
testcase_06 AC 117 ms
56,312 KB
testcase_07 AC 118 ms
55,904 KB
testcase_08 AC 117 ms
56,152 KB
testcase_09 AC 118 ms
56,100 KB
testcase_10 AC 120 ms
55,696 KB
testcase_11 AC 118 ms
55,644 KB
testcase_12 AC 119 ms
55,964 KB
testcase_13 AC 120 ms
55,972 KB
testcase_14 AC 119 ms
56,300 KB
権限があれば一括ダウンロードができます

ソースコード

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