My issue
2nd case fails ??
My code
import java.util.*;
class Codechef
{
public static void main (String[] args)
{
Scanner read = new Scanner(System.in);
int t = read.nextInt();
for(int i=0; i<t; i++)
{
ArrayList<Integer> face = new ArrayList<Integer>();
int n = read.nextInt();
int a = read.nextInt();
int b = read.nextInt();
// Update the code below to solve this problem
for(int k = 0;k<n;k++){
int c = read.nextInt();
face.add(c);
}
int count = 1;
int f = face.get(0);
for(int j =0;j<n;j++){
if(face.get(j) != f){
count = count + 1;
}
}
double p = Math.pow((1/count),n);
//double p = (a/count)*(b/count);
System.out.println(String.format("%.10f",p));
}
}
}
Learning course: Solve Programming problems using Java
Problem Link: CodeChef: Practical coding for everyone