我正在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();
}
}
请帮我找出哪里出了问题。
提前感谢!
根据注释,解决方案是将类名更改为ride
而不是Ride
。