結果

問題 No.642 Two Operations No.1
ユーザー YamaKasa
提出日時 2018-09-30 18:21:35
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 375 bytes
コンパイル時間 2,031 ms
コンパイル使用メモリ 73,936 KB
実行使用メモリ 41,748 KB
最終ジャッジ日時 2024-10-12 09:15:43
合計ジャッジ時間 4,687 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 9
権限があれば一括ダウンロードができます

ソースコード

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 t = 1;
		int cnt = 0;
		if(N == 1) {
			System.out.println(0);
			System.exit(0);
		}
		while(t < N) {
			t *= 2;
			cnt++;
		}
		int a = t - N;
		int ans = a + cnt;
		System.out.println(ans);
	}
}
0