我正在尝试USACO计算奥林匹克运动会的代码并遇到第一个问题。如果我提交以下代码,则会收到以下错误:
运行1:执行错误:程序退出,退出状态为“1'”。
------ Data for Run 1 [length=14 bytes] ------
COMETQ
HVNGAT
----------------------------
Your program printed data to stderr. Here is the data:
-------------------
Error:_Could_not_find_or_load_main_class_ride
-------------------
代码:
import java.io.*;
import java.util.*;
class Ride {
public static BufferedReader bReader;
public static PrintWriter out;
public static StringTokenizer st;
public static void initializeSys(String fileName) throws IOException {
bReader = new BufferedReader(new FileReader(fileName + ".in"));
out = new PrintWriter(new BufferedWriter(new FileWriter(fileName + ".out")));
}
public static long findSumOfLetters(String value) {
long prod = 1;
if (!value.isEmpty()) {
for (int i = 0; i < value.length(); i++) {
prod = prod * (long) (value.charAt(i) - 64);
}
}
return prod;
}
public static void yourRideIsHere() throws IOException {
String x = null;
long[] prods = new long[2];
Arrays.fill(prods, 0);
for (int i = 0; i < 2; i++) {
st = new StringTokenizer(bReader.readLine());
x = (String)st.nextElement();
prods[i] = findSumOfLetters(x.toUpperCase());
}
if (prods[0] % 47 == prods[1] % 47) {
out.print("GO");
} else {
out.print("STAY");
}
}
public static void main(String args[]) throws IOException{
initializeSys("ride");
yourRideIsHere();
out.close();
}
}
请帮我找出出错的地方。
提前致谢!
答案 0 :(得分:2)
从评论中,解决方案是将班级名称更改为ride
而不是Ride
。