結果

問題 No.378 名声値を稼ごう
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-05-04 07:10:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 616 bytes
コンパイル時間 2,867 ms
コンパイル使用メモリ 72,496 KB
実行使用メモリ 49,308 KB
最終ジャッジ日時 2023-09-12 12:48:55
合計ジャッジ時間 3,744 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,296 KB
testcase_01 AC 42 ms
49,104 KB
testcase_02 AC 42 ms
49,184 KB
testcase_03 AC 43 ms
49,272 KB
testcase_04 AC 43 ms
49,168 KB
testcase_05 AC 43 ms
49,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.System.in;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        long N = Long.parseLong(reader.readLine());
        System.out.println(N*2 - calculateReputation(N));
    }

    private static long calculateReputation(long n) {
        long reputation = 0;
        while (n != 0) {
            reputation += n;
            n = n / 2;
        }
        return reputation;
    }
}
0