結果
問題 |
No.420 mod2漸化式
|
ユーザー |
![]() |
提出日時 | 2019-11-20 00:53:25 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 787 bytes |
コンパイル時間 | 2,478 ms |
コンパイル使用メモリ | 79,500 KB |
実行使用メモリ | 56,816 KB |
最終ジャッジ日時 | 2024-10-04 16:48:28 |
合計ジャッジ時間 | 8,927 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 34 RE * 1 |
ソースコード
import java.util.*; public class Main { public static void main (String[] args) throws Exception { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); long[][] comb = new long[32][32]; for (int i = 0; i < 32; i++) { for (int j = 0; j <= i; j++) { if (j == 0 || j == i) { comb[i][j] = 1; } else { comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j]; } } } if (x > 31) { System.out.println("0 0"); return; } else if (x == 0) { System.out.println("1 0"); } long total = 0; long base = 1; for (int i = 0; i < 31; i++) { total += base; base *= 2; } long count = comb[31][x]; long sum = total * comb[30][x - 1]; System.out.println(count + " " + sum); } }