結果

問題 No.378 名声値を稼ごう
ユーザー htensaihtensai
提出日時 2019-11-20 13:47:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 277 bytes
コンパイル時間 1,994 ms
コンパイル使用メモリ 71,340 KB
実行使用メモリ 56,140 KB
最終ジャッジ日時 2023-09-15 15:24:48
合計ジャッジ時間 3,125 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,992 KB
testcase_01 AC 119 ms
55,948 KB
testcase_02 AC 122 ms
55,896 KB
testcase_03 AC 123 ms
55,820 KB
testcase_04 AC 119 ms
56,140 KB
testcase_05 AC 116 ms
55,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long max = n * 2;
		long min = n;
		while(n > 0) {
		    n /= 2;
		    min += n;
		}
	    System.out.println(max - min);
	}
}
0