結果

問題 No.378 名声値を稼ごう
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-10 01:59:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 349 bytes
コンパイル時間 2,502 ms
コンパイル使用メモリ 72,744 KB
実行使用メモリ 55,960 KB
最終ジャッジ日時 2023-09-12 07:06:31
合計ジャッジ時間 3,212 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,904 KB
testcase_01 AC 120 ms
55,708 KB
testcase_02 AC 120 ms
55,464 KB
testcase_03 AC 117 ms
55,764 KB
testcase_04 AC 119 ms
55,960 KB
testcase_05 AC 118 ms
54,088 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 sumA = 0;
        long sumB = N;
        N=N/2;
        while(N!=0){
            sumA = sumA + N;
            N=N/2;
        }
        System.out.println(sumB-sumA);
    }
}
0