結果

問題 No.378 名声値を稼ごう
ユーザー GrenacheGrenache
提出日時 2016-06-17 22:22:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 381 bytes
コンパイル時間 3,187 ms
コンパイル使用メモリ 72,368 KB
実行使用メモリ 55,988 KB
最終ジャッジ日時 2023-09-12 00:46:38
合計ジャッジ時間 4,579 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,936 KB
testcase_01 AC 125 ms
55,940 KB
testcase_02 AC 123 ms
55,924 KB
testcase_03 AC 125 ms
55,720 KB
testcase_04 AC 124 ms
55,968 KB
testcase_05 AC 122 ms
55,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;


public class Main_yukicoder378 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();

        long tmp = n;
        long ret = 0;
        while (tmp > 0) {
        	ret += tmp;
        	tmp /= 2;
        }

        System.out.println(Math.abs(2 * n - ret));

        sc.close();
    }
}
0