My issue
My code
// Update the code below to solve this problem
import java.util.Scanner;
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++)
{
int N = read.nextInt();
int X = read.nextInt();
int totalSpent = 0;
int amountRemaining = 2 * X;
for (int j = 1; j <= N; j++) {
int spentI = (int) (0.5 * amountRemaining);
amountRemaining -= spentI;
totalSpent += spentI;
}
int amountSaved = 2 * X - totalSpent;
System.out.println(amountSaved);
}
}
}
Learning course: Solve Programming problems using Java
Problem Link: CodeChef: Practical coding for everyone