結果
問題 | No.250 atetubouのzetubou |
ユーザー | Grenache |
提出日時 | 2015-07-24 23:52:23 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 2,019 ms / 5,000 ms |
コード長 | 2,540 bytes |
コンパイル時間 | 4,102 ms |
コンパイル使用メモリ | 75,384 KB |
実行使用メモリ | 114,156 KB |
最終ジャッジ日時 | 2023-09-23 00:05:08 |
合計ジャッジ時間 | 27,412 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,306 ms
112,184 KB |
testcase_01 | AC | 323 ms
107,796 KB |
testcase_02 | AC | 1,824 ms
112,100 KB |
testcase_03 | AC | 2,019 ms
112,420 KB |
testcase_04 | AC | 1,786 ms
112,352 KB |
testcase_05 | AC | 1,847 ms
112,016 KB |
testcase_06 | AC | 1,508 ms
112,424 KB |
testcase_07 | AC | 793 ms
111,156 KB |
testcase_08 | AC | 1,753 ms
112,468 KB |
testcase_09 | AC | 1,379 ms
112,616 KB |
testcase_10 | AC | 1,843 ms
112,312 KB |
testcase_11 | AC | 1,148 ms
111,168 KB |
testcase_12 | AC | 1,686 ms
114,156 KB |
testcase_13 | AC | 1,002 ms
111,368 KB |
testcase_14 | AC | 98 ms
88,208 KB |
testcase_15 | AC | 202 ms
90,836 KB |
testcase_16 | AC | 202 ms
90,700 KB |
testcase_17 | AC | 200 ms
91,168 KB |
testcase_18 | AC | 202 ms
91,084 KB |
testcase_19 | AC | 203 ms
91,108 KB |
testcase_20 | AC | 74 ms
82,736 KB |
testcase_21 | AC | 75 ms
83,032 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); } } }