結果

問題 No.381 名声値を稼ごう Extra
ユーザー GrenacheGrenache
提出日時 2016-06-18 12:47:01
言語 Java19
(openjdk 21)
結果
AC  
実行時間 4,691 ms / 8,000 ms
コード長 1,081 bytes
コンパイル時間 6,762 ms
コンパイル使用メモリ 73,900 KB
実行使用メモリ 114,336 KB
最終ジャッジ日時 2023-08-14 14:58:06
合計ジャッジ時間 8,582 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
50,164 KB
testcase_01 AC 4,691 ms
114,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.math.*;


public class Main_yukicoder381_1 {

    public static void main(String[] args) {
    	Printer pr = new Printer(System.out);

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String n;
		try {
			n = br.readLine();
		} catch (IOException e) {
			pr.close();
			throw new IllegalStateException();
		}

//		int du = 10_000;
		int du = 0x1 << 15;
		BigInteger bdu = BigInteger.TEN;
		for (int i = 0; i < 15; i++) {
			bdu = bdu.multiply(bdu);
		}

		int m = n.length() % du;
		BigInteger bn;
		if (m == 0) {
			bn = BigInteger.ZERO;
		} else {
			bn = new BigInteger(n.substring(0, m));
		}

		int loop = n.length() / du;
        for (int i = 0; i < loop; i++) {
        	String stmp = n.substring(m + i * du, m + (i + 1) * du);
        	BigInteger btmp = new BigInteger(stmp);
        	bn = bn.multiply(bdu).add(btmp);
        }

        pr.println(bn.bitCount() % 1_004_535_809);

        pr.close();
    }

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0