結果
| 問題 |
No.250 atetubouのzetubou
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-07-24 23:33:21 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,348 bytes |
| コンパイル時間 | 3,977 ms |
| コンパイル使用メモリ | 78,496 KB |
| 実行使用メモリ | 117,996 KB |
| 最終ジャッジ日時 | 2024-07-16 00:20:39 |
| 合計ジャッジ時間 | 30,385 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 WA * 13 |
ソースコード
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.nextLong();
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();
}
}
}
}