q = gets.not_nil!.chomp.to_i q.times do d64, x64, t = gets.not_nil!.chomp.split.map{|s| s.to_i64} d = d64.to_i32 x = x64.to_i32 dp = Array.new(x+1, 1) (d-2).times do next_dp = Array.new(x+1, 0) dp.each_with_index do |v, i| (x+1).times do |j| # puts "i:#{i} j:#{j}" next_dp[j + i] += v if i + j <= x end end # puts next_dp dp = next_dp end count = d == 1 ? 1 : dp.sum puts "count:#{count}" if count > t puts "ZETUBOU" else puts "AC" end end