Hi all,
I have an algorithm for this problem (code PRIME1). It runs reasonably fast, but I'm still getting "wrong answer". I tried to test the code many times on different inputs and I'm unable to figure out, where the problem is.
I submit the solution as JAR.
The code of main "main" method is here:
public static void main(String[] args) {
PrimeGenerator generator = new PrimeGenerator();
try {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int numberOfTests = Integer.valueOf(in.readLine());
boolean first = true;
for(int i = 0; i < numberOfTests; i++) {
String[] interval = in.readLine().split(" ");
if(! first )
System.out.println("");
else
first = false;
generator.printInterval(Integer.valueOf(interval[0]),
Integer.valueOf(interval[1]) );
}
} catch(IOException e) { }
}
Can anyone see a problem here? The algorithm itself is hidden in the PrimeGenerator class - but I do believe, that it works fine. I there might be a problem with parsing the input or producing the output.
Also, if you've got some test inputs, I'd like to see them. I have found couple of test inputs on this forum, but it looks like the code works fine for those inputs.
Thanks a lot
Tony