I'm trying to learn how to communicate with the judge.... I found the "3n+1" problem suitable for this task.
I keep getting "wrong answer" when using this code:
- Code: Select all
public static void main(String[] args){
Scanner input = new Scanner(System.in);
String nextLine = null;
Scanner line = null;
while(input.hasNextLine() && (nextLine = input.nextLine()).length()>0){
line = new Scanner(nextLine);
long min=0;
long max=0;
min=line.nextLong();
max=line.nextLong();
int maxLength=0;
int temp=0;
long start = System.currentTimeMillis();
for(long i=min;i<=max;i++){
temp=count2(i);
maxLength=Math.max(temp, maxLength);
}
long end = System.currentTimeMillis();
System.out.println(min+" "+max+" "+maxLength);
System.err.println((end-start)+"ms");
}
}
Does any of you know if this should work and it's just my code in "count2" which is giving out the wrong answers? (it does of cause comply with the answers in the text and the timelimit)
regards
Asbjørn Aarrestad
