結果
問題 | No.250 atetubouのzetubou |
ユーザー | Grenache |
提出日時 | 2015-07-24 23:30:19 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,347 bytes |
コンパイル時間 | 3,292 ms |
コンパイル使用メモリ | 79,128 KB |
実行使用メモリ | 75,500 KB |
最終ジャッジ日時 | 2024-07-08 14:13:47 |
合計ジャッジ時間 | 5,694 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | AC | 86 ms
73,764 KB |
testcase_21 | AC | 85 ms
73,820 KB |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Iterator; public class Main_yukicoder250 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); preCombiLong(3000); int q = sc.nextInt(); for (int i = 0; i < q; i++) { int d = sc.nextInt(); int x = sc.nextInt(); long t = sc.nextInt(); try { if (combinationLong(x + d - 1, x) <= t) { System.out.println("AC"); } else { System.out.println("ZETUBOU"); } } catch (RuntimeException e) { System.out.println("ZETUBOU"); } } sc.close(); } private static long[][] cacheLong; private static void preCombiLong(int size) { // cache size need size * size * 4. // size : ~3000 cacheLong = new long[size + 1][]; for (int i = 0; i <= size; i++) { cacheLong[i] = new long[i + 1]; cacheLong[i][0] = 1; cacheLong[i][i] = 1; } } private static long combinationLong(int n, int r) { r = Math.min(n - r, r); if (cacheLong[n][r] == 0) { cacheLong[n][r] = combinationLong(n - 1, r) + combinationLong(n - 1, r - 1); if (cacheLong[n][r] < 0) { throw new RuntimeException("Long Overflow!"); } } return cacheLong[n][r]; } @SuppressWarnings("unused") private static class Scanner { BufferedReader br; Iterator<String> it; Scanner (InputStream in) { br = new BufferedReader(new InputStreamReader(in)); } String next() throws RuntimeException { try { if (it == null || !it.hasNext()) { it = Arrays.asList(br.readLine().split(" ")).iterator(); } return it.next(); } catch (IOException e) { throw new IllegalStateException(); } } int nextInt() throws RuntimeException { return Integer.parseInt(next()); } long nextLong() throws RuntimeException { return Long.parseLong(next()); } float nextFloat() throws RuntimeException { return Float.parseFloat(next()); } double nextDouble() throws RuntimeException { return Double.parseDouble(next()); } void close() { try { br.close(); } catch (IOException e) { // throw new IllegalStateException(); } } } }