結果

問題 No.378 名声値を稼ごう
ユーザー yagi2yagi2
提出日時 2017-04-17 16:20:47
言語 Java19
(openjdk 21)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 538 bytes
コンパイル時間 3,123 ms
コンパイル使用メモリ 72,384 KB
実行使用メモリ 57,768 KB
最終ジャッジ日時 2023-09-12 12:43:32
合計ジャッジ時間 3,989 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,660 KB
testcase_01 AC 118 ms
55,704 KB
testcase_02 AC 121 ms
55,812 KB
testcase_03 AC 119 ms
55,960 KB
testcase_04 AC 120 ms
55,748 KB
testcase_05 AC 120 ms
57,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigInteger;
import java.util.Scanner;

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

        BigInteger N = new BigInteger(sc.next());

        BigInteger tmp = N;
        BigInteger M = BigInteger.ZERO;
        while (tmp.compareTo(BigInteger.ZERO) == 1) {
            M = M.add(tmp);
            tmp = tmp.divide(new BigInteger("2"));
        }

        BigInteger Q = N.multiply(new BigInteger("2"));

        System.out.println(Q.subtract(M));
    }
}
0