結果

問題 No.250 atetubouのzetubou
ユーザー uafr_csuafr_cs
提出日時 2015-09-03 02:52:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 914 ms / 5,000 ms
コード長 1,357 bytes
コンパイル時間 5,117 ms
コンパイル使用メモリ 73,936 KB
実行使用メモリ 122,744 KB
最終ジャッジ日時 2023-09-26 02:31:11
合計ジャッジ時間 23,916 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 782 ms
118,748 KB
testcase_01 AC 647 ms
113,180 KB
testcase_02 AC 817 ms
118,464 KB
testcase_03 AC 866 ms
118,752 KB
testcase_04 AC 834 ms
118,812 KB
testcase_05 AC 835 ms
118,524 KB
testcase_06 AC 782 ms
117,764 KB
testcase_07 AC 762 ms
118,844 KB
testcase_08 AC 858 ms
118,624 KB
testcase_09 AC 754 ms
116,248 KB
testcase_10 AC 832 ms
118,700 KB
testcase_11 AC 765 ms
118,556 KB
testcase_12 AC 796 ms
118,480 KB
testcase_13 AC 788 ms
118,520 KB
testcase_14 AC 465 ms
112,988 KB
testcase_15 AC 886 ms
118,784 KB
testcase_16 AC 914 ms
122,744 KB
testcase_17 AC 840 ms
118,660 KB
testcase_18 AC 845 ms
118,848 KB
testcase_19 AC 856 ms
118,552 KB
testcase_20 AC 438 ms
112,748 KB
testcase_21 AC 440 ms
112,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Set;

public class Main {
	
	public static long naive_solve(final int deep, final int T, final int X){
		if(deep >= T){
			return 1;
		}
		
		long ret = 0;
		for(int i = 0; i <= X; i++){
			ret += naive_solve(deep + 1, T, X - i);
		}
		
		return ret;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int N_MAX = 3000;
		final int M_MAX = 1500;
		
		long[][] nCk = new long[N_MAX + 1][M_MAX + 1];
		nCk[0][0] = 1;
		for(int i = 1; i <= N_MAX; i++){
			for(int j = 0; j <= Math.min(i, M_MAX); j++){
				if(j != i){ 
					nCk[i][j] += nCk[i - 1][j];
				}
				
				if(j != 0){
					BigInteger big = BigInteger.valueOf(nCk[i][j]);
					big = big.add(BigInteger.valueOf(nCk[i - 1][j - 1]));

					if(big.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) >= 0){
						nCk[i][j] = Long.MAX_VALUE;
					}else{
						nCk[i][j] += nCk[i - 1][j - 1];
					}
				}
			}
		}
		
		final int Q = sc.nextInt();
		for(int q = 0; q < Q; q++){
			final int D = sc.nextInt();
			final int X = sc.nextInt();
			final long T = sc.nextLong();
			
			final long comb = nCk[D + X - 1][X];
			//System.out.println(comb);
			
			System.out.println(comb <= T ? "AC" : "ZETUBOU");
		}
	}

}
0