結果

問題 No.250 atetubouのzetubou
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-14 18:00:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 719 ms / 5,000 ms
コード長 1,105 bytes
コンパイル時間 2,311 ms
コンパイル使用メモリ 76,840 KB
実行使用メモリ 120,492 KB
最終ジャッジ日時 2023-10-25 03:31:06
合計ジャッジ時間 17,588 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 633 ms
116,496 KB
testcase_01 AC 530 ms
96,496 KB
testcase_02 AC 677 ms
118,416 KB
testcase_03 AC 695 ms
118,292 KB
testcase_04 AC 679 ms
116,300 KB
testcase_05 AC 699 ms
117,292 KB
testcase_06 AC 669 ms
111,740 KB
testcase_07 AC 602 ms
114,212 KB
testcase_08 AC 691 ms
113,760 KB
testcase_09 AC 642 ms
116,892 KB
testcase_10 AC 668 ms
117,804 KB
testcase_11 AC 635 ms
116,280 KB
testcase_12 AC 666 ms
113,584 KB
testcase_13 AC 629 ms
113,056 KB
testcase_14 AC 326 ms
92,320 KB
testcase_15 AC 708 ms
113,864 KB
testcase_16 AC 719 ms
120,492 KB
testcase_17 AC 692 ms
118,716 KB
testcase_18 AC 695 ms
118,584 KB
testcase_19 AC 696 ms
118,280 KB
testcase_20 AC 306 ms
90,104 KB
testcase_21 AC 308 ms
92,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    // dp[i][j]はi個の変数(≧0)の和がj以下となるような場合の数(10^15+1以上の場合は10^15+1とする)
    long[][] dp = new long[1500][1501];
    // sum[i][j] = dp[i][0] +...+dp[i][j]
    long[][] sum = new long[1500][1501];
    for(int j = 0; j < 1501; j++) {
      dp[0][j] = 1;
      sum[0][j] = j + 1;
    }
    for(int i = 1; i < 1500; i++) {
      dp[i][0] = 1;
      sum[i][0] = 1;
      for(int j = 1; j < 1501; j++) {
        dp[i][j] = sum[i - 1][j];
        if(sum[i][j - 1] + dp[i][j] >= (long)Math.pow(10, 15) + 1) {
          sum[i][j] = (long)Math.pow(10, 15) + 1;
        } else {
          sum[i][j] = sum[i][j - 1] + dp[i][j];
        }
      }
    }
    int Q = sc.nextInt();
    for(int i = 0; i < Q; i++) {
      int d = sc.nextInt();
      int x = sc.nextInt();
      long t = sc.nextLong();
      if(dp[d - 1][x] <= t) {
        System.out.println("AC");
      } else {
        System.out.println("ZETUBOU");
      }
    }
  }
}
0