Hey guys,
I am practicing the IARCS Problem Archive.
When I am trying to submit a solution in Java, I get the following error:
Runtime Error: EXIT
Description: Program did not return 0
Please help as I am new to this.
This is the code I have written for the "Tiles" program.
import java.util.*;class Main {private boolean check(String s) {String s1=s;//If it has double 0 in it, replace it with some random special character. So only lonely zeroes will be presents1=s1.replace("00","$");char[] ch=s1.toCharArray();for(int i=0;i<ch.length;i++){if(ch[i]=='0')//If there are any lonely zeroes, then return false.return false;}return true;}public static void main(String[] args) {Main ob=new Main();int count=0;Scanner sc=new Scanner(System.in);//Taking Inputint n=sc.nextInt();int[] t=new int[n];String[] s=new String[(int) Math.pow(2,n)];for(int i=0;i<Math.pow(2,n);i++){int temp=i;//Converting the integers from 0 to 2^(n-1) into binaryfor(int j=0;j<n;j++){t[j]=temp%2;temp=temp/2;}//Concatenating the digits of the binary number into a String. Like 15 as "1111"for(int k=0;k<t.length;k++){s[i]+=Integer.toString(t[k]);}//passing the String to a function that checks the given conditionsboolean boo = ob.check(s[i]);if(boo==true)count++;}System.out.println(count);}}