I am practicing for USACO Bronze and came across the Fence Painting Problem from USACO 2015 December. My code is working on Eclipse and everything is fine but when the USACO website tests it, I get this error:
Error: Could not find or load main class Paint
Caused by: java.lang.NoClassDefFoundError: introduction/Paint (wrong name: Paint)
I have no idea what is causing this.
This is my code:
package introduction;
import java.io.*;
import java.util.*;
public class Paint {
public static void main(String args[]) throws IOException {
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("paint.out")));
Scanner keyboard = new Scanner(new FileReader("paint.in"));
int a = keyboard.nextInt();
int b = keyboard.nextInt();
int c = keyboard.nextInt();
int d = keyboard.nextInt();
if (a<c && b==d) {
out.println(b-a);
}
if (a<c && b<d) {
out.println(d-a);
}
if (a<c && b>d) {
out.println(b-a);
}
if (a>c && b==d) {
out.println(d-c);
}
if (a>c && b<d) {
out.println(d-c);
}
if (a>c && b>d) {
out.println(b-c);
}
if (a==c && b==d) {
out.println(b-a);
}
if (a==c && b<d) {
out.println(d-c);
}
if (a==c && b>d) {
out.println(b-a);
}
out.close();
}
}