結果
問題 | No.250 atetubouのzetubou |
ユーザー | Grenache |
提出日時 | 2015-07-24 23:52:23 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 1,916 ms / 5,000 ms |
コード長 | 2,540 bytes |
コンパイル時間 | 3,719 ms |
コンパイル使用メモリ | 79,136 KB |
実行使用メモリ | 116,248 KB |
最終ジャッジ日時 | 2024-07-16 00:37:50 |
合計ジャッジ時間 | 26,877 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,271 ms
114,592 KB |
testcase_01 | AC | 324 ms
105,316 KB |
testcase_02 | AC | 1,732 ms
114,564 KB |
testcase_03 | AC | 1,916 ms
114,456 KB |
testcase_04 | AC | 1,705 ms
114,272 KB |
testcase_05 | AC | 1,757 ms
114,976 KB |
testcase_06 | AC | 1,438 ms
116,248 KB |
testcase_07 | AC | 868 ms
114,956 KB |
testcase_08 | AC | 1,644 ms
114,556 KB |
testcase_09 | AC | 1,329 ms
115,072 KB |
testcase_10 | AC | 1,742 ms
115,088 KB |
testcase_11 | AC | 1,169 ms
114,364 KB |
testcase_12 | AC | 1,626 ms
114,888 KB |
testcase_13 | AC | 1,039 ms
115,000 KB |
testcase_14 | AC | 115 ms
87,968 KB |
testcase_15 | AC | 221 ms
90,480 KB |
testcase_16 | AC | 224 ms
90,928 KB |
testcase_17 | AC | 227 ms
92,912 KB |
testcase_18 | AC | 226 ms
91,008 KB |
testcase_19 | AC | 222 ms
90,228 KB |
testcase_20 | AC | 90 ms
83,728 KB |
testcase_21 | AC | 89 ms
82,980 KB |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Iterator; public class Main_yukicoder250 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Printer pr = new Printer(System.out); preCombiLong(3000); int q = sc.nextInt(); for (int i = 0; i < q; i++) { int d = sc.nextInt(); int x = sc.nextInt(); long t = sc.nextLong(); try { if (combinationLong(x + d - 1, x) <= t) { pr.println("AC"); } else { pr.println("ZETUBOU"); } } catch (RuntimeException e) { pr.println("ZETUBOU"); } } pr.close(); 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(); } } } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }