0
Google 코드 잼 질문 중 하나를 수행하고 있었고이 시점에서 고생했습니다. 코드가 올바르게 컴파일되지만 'N'입력 후에는 더 이상 진행되지 않습니다. 논리적 오류처럼 보이지만 코드를 실행하면 잘 보입니다. 여기서 문제가 될 수있는 것은 무엇입니까? 질문은 여기에있다 https://code.google.com/codejam/contest/6254486/dashboard코드 스 니펫에 논리적 오류가 있습니까?
public class Counting_Sheep
{
static int haha,digit,j;
static int arr[]=new int[11];
public static void main(String args[])throws IOException{
BufferedReader obj=new BufferedReader(new InputStreamReader(System.in));
Scanner in= new Scanner(System.in);
System.out.println("Number of test cases");
int t=in.nextInt();
System.out.println("Enter N by Bleatrix");
int n=Integer.parseInt(obj.readLine());
if(n==0){
System.out.println("INSOMNIA");
System.exit(0);
}
for(int i=1;i<=n+1;i++){
haha=i*n;
numbercalculator(haha);
}
for(int i=0;i<11;i++)
System.out.println(arr[i]);
}
static void numbercalculator(int a){
while(a>0){
digit=a%10;
if(digitIsUnique(digit)){
arr[j]=digit;
j++;
}
}
}
static boolean digitIsUnique(int b){
for(int i=0;i<11;i++){
if(b==arr[i])
return false;
else
return true;
}
return false;
}
}
디버거와 함께 실행 해 보셨습니까? – RealSkeptic