結果
問題 |
No.381 名声値を稼ごう Extra
|
ユーザー |
|
提出日時 | 2016-06-18 12:47:01 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 4,847 ms / 8,000 ms |
コード長 | 1,081 bytes |
コンパイル時間 | 4,035 ms |
コンパイル使用メモリ | 76,500 KB |
実行使用メモリ | 96,740 KB |
最終ジャッジ日時 | 2024-11-22 13:12:10 |
合計ジャッジ時間 | 8,872 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 |
ソースコード
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); } } }