以下是我的code
很疑惑說,為什麼這種做會TLE?
import java.io.*;
import java.util.Scanner;
public class Practice
{
public static void main(String[] args)throws IOException
{
Scanner in=new Scanner(System.in);
int t;
while(in.hasNext())
{
t=in.nextInt();
for(int i=0;i<t;i++)
{
int product=1;
int test;
test=in.nextInt();
int j=System.in.read();
boolean exist_0=false;
while(j != 10)
{
if(j>='1' && j<='9' && exist_0 == false)
product*=(j-'0');
else if(j == '0')
exist_0=true;
j=System.in.read();
}
if(exist_0)
System.out.println(0);
else
System.out.println(product);
}
}
}
}