https://radinehsan.wordpress.com/2012/03/21/solution-to-google-code-jam-qualification-round-africa-2010-problems/
This link provides all the solution to the GCJ problems of Africa 2010 Qualifiers. On Sat, Apr 7, 2012 at 11:50 PM, mohit gupta <[email protected]> wrote: > I have coded the Below program for Store Credit - GCJ 2010 (Africa) > Problem > > Problem Description link:http://code.google.com/codejam/contest/351101/ > dashboard#s=p0<http://code.google.com/codejam/contest/351101/%0Adashboard#s=p0> > > import java.io.IOException; > import java.io.FileReader; > import java.io.BufferedReader; > import java.util.*; > > public class Test { > > > public static void main(String arg[]) throws IOException{ > > String text; > FileReader fr=new FileReader("E:/test.txt"); > BufferedReader br=new BufferedReader(fr); > int l=Integer.parseInt(br.readLine()); > l=l*3; > String []size=new String[l]; > ArrayList<String> ar=new ArrayList<String>(); > > > for(int i=0;i<l;i++){ > > ar.add(br.readLine()); > > } > > > > int arr; > int caase,sum,index1,index2; caase=index1=index2=0; > String[] items; > int itemss[]; > for(int j=0;j<l;j++){ > > > sum=Integer.parseInt((ar.get(j)).trim()); > > arr=Integer.parseInt((ar.get(++j)).trim()); > > items=ar.get(++j).split(" "); > itemss=new int[arr]; > > for(int i=0;i<arr;i++) > { > itemss[i]=Integer.parseInt(items[i]); > } > > > for(int a=0;a<arr;a++){ > for(int b=0;b<arr;b++){ > if(a!=b){ > > if((itemss[a]+itemss[b])==sum){ > > index1=a+1;index2=b+1; > > > } > > } > } > > } > caase=caase+1; > System.out.println("case#"+caase+":"+index1+" "+index2); > > } > > > > } > } > > Here Test.txt is the input file with test cases. > > Please advise as how can LOC(lines of code) for the solution coded > above can be minimized and performance can be increased for the same. > > -- > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-code?hl=en. > > -- Regards, Radin Blog: https://radinehsan.wordpress.com "Here's to the crazy ones, the misfits, the rebels, the troublemakers, the round pegs in the square holes... the ones who see things differently - - they're not fond of rules... You can quote them, disagree with them, glorify or vilify them, but the only thing you can't do is ignore them because they change things... they push the human race forward, and while some may see them as the crazy ones, we see genius, because the ones who are crazy enough to think that they can change the world, are the ones who do." -- Steve Jobs <http://en.wikipedia.org/wiki/Steve_Jobs> -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-code?hl=en.
