My code here is running properly on my compiler but codechef is showing wrong answer. Can anyone please tell me what is wrong in this program.
import java.util.*;
public class CEILRCPT
{
public static void main(String arg[])
{
Scanner in=new Scanner(System.in);
//System.out.println("Enter the number of test cases.");
int n=in.nextInt();
int r[]=new int[n];
int cost[]=new int[n];int count=0;
for(int i=0;i<n;i++)
{r[i]=in.nextInt();cost[i]=0;
// count++;
}
for(int i=0;i<n;i++)
{
for(int j=11;j>=0;j--)
{
int pro=(int)Math.pow(2,j);
if(r[i]%pro==0)
{
cost[i]=cost[i]+r[i]/pro;
break;
}
else if(pro<r[i])
{r[i]=r[i]%pro;cost[i]++;}
}
}
for(int i=0;i<n;i++)
System.out.println(cost[i]);
}
}