結果
問題 | No.250 atetubouのzetubou |
ユーザー |
|
提出日時 | 2018-02-19 23:23:32 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 233 ms / 5,000 ms |
コード長 | 1,756 bytes |
コンパイル時間 | 3,539 ms |
コンパイル使用メモリ | 77,600 KB |
実行使用メモリ | 90,412 KB |
最終ジャッジ日時 | 2024-07-16 03:53:17 |
合計ジャッジ時間 | 9,387 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
ソースコード
package yukicoder;import java.io.BufferedReader;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import java.io.PrintWriter;import java.util.StringTokenizer;public class P250 {static long INF = 1000000000000000L+1;static long[][] memo = new long[3000][1500];public static void main(String[] args) throws IOException {Scanner sc = new Scanner(System.in);PrintWriter pw=new PrintWriter(System.out);for(int i=0; i<3000; i++) memo[i][0] = 1;for(int i=1; i<1500; i++) memo[i][i] = 1;for(int a=1; a<3000; a++) {for(int b=1; b<a && b<1500; b++) {if(memo[a-1][b-1]>=INF || memo[a-1][b]>=INF) {memo[a][b] = INF;} else {memo[a][b] = memo[a-1][b-1]+memo[a-1][b];}}}int Q = sc.nextInt();for(int i=0; i<Q; i++) {int d = sc.nextInt();int x = sc.nextInt();long t = sc.nextLong();if(memo[d+x-1][d-1]<=t) {pw.println("AC");} else {pw.println("ZETUBOU");}}pw.close();}static class Scanner{BufferedReader br;StringTokenizer st;public Scanner(InputStream s){br=new BufferedReader(new InputStreamReader(s));}public String nextLine() throws IOException{return br.readLine();}public String next() throws IOException{while(st==null || !st.hasMoreTokens())st=new StringTokenizer(br.readLine());return st.nextToken();}public int nextInt() throws IOException{return Integer.parseInt(next());}public double nextDouble() throws IOException{return Double.parseDouble(next());}public boolean ready() throws IOException{return br.ready();}public long nextLong() throws IOException{return Long.parseLong(next());}}}