結果

問題 No.642 Two Operations No.1
ユーザー Tsukasa_Type
提出日時 2018-03-06 14:15:13
言語 Java
(openjdk 23)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 2,327 ms
コンパイル使用メモリ 73,788 KB
実行使用メモリ 54,352 KB
最終ジャッジ日時 2024-09-18 21:42:47
合計ジャッジ時間 4,826 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import static java.lang.System.*;

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