/* Sample solution for NCPC 2006: Shootout * Author: Truls A. Bjoerklund * * The solution is by dynamic programming where the states are given by which * cowboys that are alive and whose turn it is next. * * In order to avoid circular dependencies among states, the known sum of a * geometric series is used. */ import java.io.*; import java.text.NumberFormat; import java.util.ArrayList; public class shootout_tab { public static void main(String[] args) throws Exception{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(5); nf.setMinimumFractionDigits(5); int t = Integer.parseInt(in.readLine()); for(int c=0;c pos = new ArrayList(); for(int j=0;j0){ p_all_misses*=restp[j]; pos.add(j); } if(pos.size()==1){ p[i][pos.get(0)]=new double[n]; p[i][pos.get(0)][pos.get(0)]=1.0; } else{ for(int j=0;j best = new ArrayList(); double bestval=0.0; p[i][pos.get(j)]= new double[n]; for(int k=0;kbestval) bestval=p[ind][pos.get(next)][pos.get(j)]; } for(int k=0;k