i solving this problem; runs on eclipse giving run time error on spoj platform ...anyone can please tell me error?
import java.util.scanner; public class main22 { /** * @param args */ public static void main(string[] args) { // todo auto-generated method stub boolean[][] arr=new boolean[100][10000]; int[]arry=new int[100]; int sum,total,i,j,test,no; scanner inp = new scanner(system.in); test = inp.nextint(); while(test--!=0) { sum = 0; no = inp.nextint(); for(i=1;i<=no;i++) { arry[i]=inp.nextint(); sum+=arry[i]; } for(i=0;i<=no;i++) { arr[i][0]=true; } for(i=1;i<=sum;i++) { arr[0][i]=false; } for(i=1;i<=no;i++) { for(j=1;j<=sum;j++) { if(arry[i]>j) arr[i][j]=arr[i-1][j]; else { arr[i][j]=((arr[i-1][j])||(arr[i-1][j-arry[i]])); } } } total = 0; for(j=1;j<=sum;j++) { if((arr[no][j])) { total+=j; } } system.out.println(total); } } }
as know on spoj main class should called main while in code main22
Comments
Post a Comment