結果

問題 No.378 名声値を稼ごう
ユーザー YamaKasaYamaKasa
提出日時 2018-05-22 22:29:33
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 417 bytes
コンパイル時間 2,064 ms
コンパイル使用メモリ 72,252 KB
実行使用メモリ 58,640 KB
最終ジャッジ日時 2023-09-11 01:23:58
合計ジャッジ時間 3,633 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 120 ms
56,040 KB
testcase_03 AC 118 ms
55,688 KB
testcase_04 WA -
testcase_05 AC 117 ms
55,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long N = scan.nextLong();
		scan.close();
		int k = (int) (Math.log10(N) / Math.log10(2));
		long sum = N;
		for(int i = 0; i < k; i++) {
			long a = (long) Math.pow(2, (i + 1));
			sum += (long) (N / a);
		}
		long ans = N + ((long) (N / 2)) * 2 - sum;
		System.out.println(ans);
	}
}
0