Can you please specify the problem?
On Thu, Apr 28, 2011 at 10:49 AM, vettukal <[email protected]> wrote:
> May be this solve the problme
>
> BigInteger product = new BigInteger("0");
> BigInteger first = new BigInteger("0");
> BigInteger second = new BigInteger("0");
>
> for(int i=0;i<atomList.length;i++)
> {
> first=new
> BigInteger(Integer.toString(atomList[i]));
> second=new
> BigInteger(Integer.toString(atomList2[(atomList.length-1)-i]));
>
> product=product.add(first.multiply(second));
> }
>
> On Apr 26, 8:33 pm, Seydou TAPSOBA <[email protected]> wrote:
> > I don't know what is the matter with this code but the large input
> doesn't
> > worh
> >
> > this is my code in java
> >
> > import java.io.File;
> > import java.io.FileNotFoundException;
> > import java.io.PrintWriter;
> > import java.math.BigInteger;
> > import java.util.Arrays;
> > import java.util.Scanner;
> >
> > public class scalar1 {
> >
> > public static void main(String[] args) throws FileNotFoundException {
> >
> > //Scanner in = new Scanner(new File("A-small-practice.in"));
> > Scanner in = new Scanner(new File("A-large-practice.in"));
> > PrintWriter out = new PrintWriter(new File("minimumBig.out"));
> >
> > int cas = 1;
> > BigInteger resultat = BigInteger.ZERO;
> >
> > int T = in.nextInt();
> > int dim = 0;
> >
> > int u[];
> > int v[];
> >
> > while(in.hasNext()) {
> >
> > dim = in.nextInt();
> > u = new int[dim];
> > v = new int[dim];
> >
> > for (int i = 0; i < dim; i++) {
> > u[i] = in.nextInt();
> > }
> > for (int i = 0; i < dim; i++) {
> > v[i] = in.nextInt();
> > }
> >
> > Arrays.sort(u);
> > Arrays.sort(v);
> > for (int i = 0; i < v.length; i++) {
> > long temp = u[i]*v[dim-i-1];
> >
> > resultat = resultat.add(new BigInteger(""+temp));
> >
> > }
> >
> > out.print("Case #"+cas+": ");
> > out.print(resultat);
> > if(in.hasNext())out.println();
> > cas++;
> > resultat = BigInteger.ZERO;
> > }
> > out.close();
> >
> > }
> >
> >
> >
> >
> >
> >
> >
> > }
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-codejam" 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.
>
>
--
Umer
--
You received this message because you are subscribed to the Google Groups
"google-codejam" 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.