結果
問題 |
No.589 Counting Even
|
ユーザー |
|
提出日時 | 2017-11-09 03:26:40 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 839 bytes |
コンパイル時間 | 1,814 ms |
コンパイル使用メモリ | 75,488 KB |
実行使用メモリ | 54,724 KB |
最終ジャッジ日時 | 2024-11-24 06:20:53 |
合計ジャッジ時間 | 5,975 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 RE * 14 |
ソースコード
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { new Main().run(); } static long[][] c = new long[10][10]; { c[0][0] = 1; for (int i = 1; i < 10; ++i) { for (int j = 0; j <= i; ++j) { c[i][j] = c[i - 1][j] + (j > 0 ? c[i - 1][j - 1] : 0); // if (c[i][j] % 2 == 0) { // System.out.println(Integer.toBinaryString(i)); // System.out.println(Integer.toBinaryString(j)); // System.out.println(); // } } } } static void run() { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); int[] cnt = new int[2]; long d = n; while (d > 0) { ++cnt[(int) d % 2]; d /= 2; } System.out.println((n + 1) - (1L << cnt[1])); } static void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }