結果

問題 No.420 mod2漸化式
ユーザー nkhrlabnkhrlab
提出日時 2018-07-12 03:26:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 122 ms / 1,000 ms
コード長 1,008 bytes
コンパイル時間 3,912 ms
コンパイル使用メモリ 77,268 KB
実行使用メモリ 57,660 KB
最終ジャッジ日時 2023-10-23 20:47:13
合計ジャッジ時間 9,754 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
56,980 KB
testcase_01 AC 114 ms
57,284 KB
testcase_02 AC 112 ms
57,268 KB
testcase_03 AC 114 ms
57,436 KB
testcase_04 AC 113 ms
57,288 KB
testcase_05 AC 113 ms
57,252 KB
testcase_06 AC 50 ms
53,516 KB
testcase_07 AC 114 ms
57,440 KB
testcase_08 AC 113 ms
57,388 KB
testcase_09 AC 111 ms
57,208 KB
testcase_10 AC 115 ms
57,468 KB
testcase_11 AC 114 ms
57,360 KB
testcase_12 AC 115 ms
57,540 KB
testcase_13 AC 114 ms
57,440 KB
testcase_14 AC 114 ms
57,372 KB
testcase_15 AC 114 ms
57,312 KB
testcase_16 AC 114 ms
57,412 KB
testcase_17 AC 119 ms
57,356 KB
testcase_18 AC 115 ms
57,132 KB
testcase_19 AC 113 ms
56,996 KB
testcase_20 AC 121 ms
57,524 KB
testcase_21 AC 116 ms
57,556 KB
testcase_22 AC 115 ms
57,336 KB
testcase_23 AC 117 ms
57,524 KB
testcase_24 AC 118 ms
57,660 KB
testcase_25 AC 117 ms
57,496 KB
testcase_26 AC 116 ms
57,472 KB
testcase_27 AC 116 ms
57,452 KB
testcase_28 AC 116 ms
57,332 KB
testcase_29 AC 116 ms
57,352 KB
testcase_30 AC 121 ms
57,496 KB
testcase_31 AC 122 ms
57,484 KB
testcase_32 AC 116 ms
55,480 KB
testcase_33 AC 51 ms
53,528 KB
testcase_34 AC 52 ms
53,508 KB
testcase_35 AC 52 ms
53,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    int x = Integer.parseInt(s);

    long[][] z = new long[100][100];
    long[][] c = new long[100][100];

    if(x == 0)
    {
      System.out.println("1 0");
      return;
    }

    if(x > 31)
    {
      System.out.println("0 0");
      return;
    }

    for(int i = 1; i <= 31; i++)
    {
      z[1][i] = (1 << i) - 1;
      c[1][i] = i;
      //System.out.println(z[1][i]);
    }

    for(int i = 2; i <= x; i++)
    {
      for(int j = 1; j <= 31; j++)
      {
        for(int k = i; k <= j; k++)
        {
          z[i][j] += c[i - 1][k - 1] * (1 << (k - 1)) + z[i - 1][k - 1];
          c[i][j] += c[i - 1][k - 1];
        }
      }
    }

    
    System.out.printf("%d %d\n", c[x][31], z[x][31]);

  }

}
0