For this problem, my algorithm is giving TLE in Java but it’s getting accepted in Python.
What am I missing?
//imports for BufferedReader
import java.io.BufferedReader;
import java.io.InputStreamReader;
//import for Scanner and other utility classes
import java.util.*;
class TestClass {
public static void main(String args[] ) throws Exception {
//Scanner
Scanner s = new Scanner(System.in);
int t= s.nextInt();
// System.out.println(t);
while(t>0){
int n = s.nextInt();
double a[]=new double[n];
double b[]=new double[n];
for(int i=0;i<n;i++){
a[i]=s.nextDouble();
if (i==0 || a[i]>=b[i-1]){
b[i]=a[i];
}
else{
double mult=Math.ceil(b[i-1]/a[i]);
b[i]=a[i]*mult;
}
}
for(double arr:b){
System.out.print((int)arr+" ");
}
System.out.println();
t--;
}
}
}