Search found 4 matches
- Tue Nov 10, 2009 9:54 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 319909
Re: 100 (Bad) Wrong answer
Solved xD I tought I shouldn't end with a '\n'
- Tue Nov 10, 2009 9:51 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 319909
Re: 100 (Bad) Wrong answer
I changed this
if(veces==0) System.out.print(Math.min(a, b)+" "+Math.max(a, b)+" "+maxSteps);
else System.out.print("\n"+a+" "+b+" "+maxSteps);
for this:
if(veces>0)
System.out.println();
System.out.print(Math.min(a, b)+" "+Math.max(a, b)+" "+maxSteps);
veces=1;
Still not working :(
if(veces==0) System.out.print(Math.min(a, b)+" "+Math.max(a, b)+" "+maxSteps);
else System.out.print("\n"+a+" "+b+" "+maxSteps);
for this:
if(veces>0)
System.out.println();
System.out.print(Math.min(a, b)+" "+Math.max(a, b)+" "+maxSteps);
veces=1;
Still not working :(
- Tue Nov 10, 2009 9:44 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 319909
100 (Bad) Wrong answer
Hello, can somebody tell me why I am getting wrong answer? These are both optimized and brute force codes:
Optimized:
import java.io.*;
import java.util.*;
public class Main{
static long maxSteps=1;
static long[]bigMatrix=new long[1000001];
static StringTokenizer st;
static int veces=0;
public ...
Optimized:
import java.io.*;
import java.util.*;
public class Main{
static long maxSteps=1;
static long[]bigMatrix=new long[1000001];
static StringTokenizer st;
static int veces=0;
public ...
- Tue Nov 10, 2009 9:40 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 319909
Re: 100
Hello, can somebody tell me why I am getting wrong answer? These are both optimized and brute force codes:
Optimized:
import java.io.*;
import java.util.*;
public class Main{
static long maxSteps=1;
static long[]bigMatrix=new long[1000001];
static StringTokenizer st;
static int veces=0;
public ...
Optimized:
import java.io.*;
import java.util.*;
public class Main{
static long maxSteps=1;
static long[]bigMatrix=new long[1000001];
static StringTokenizer st;
static int veces=0;
public ...