Java实现 洛谷 P1200 [USACO1.1]你的飞碟在这儿Your Ride Is He…
转载
import java.util.Scanner;
public class Main{
private static Scanner cin;
public static void main(String args[])throws Exception {
cin = new Scanner(System.in);
String comet = cin.nextLine();
long cometNum = calc(comet);
String team = cin.nextLine();
long teamNum = calc(team);
if( cometNum == teamNum) {
System.out.println("GO");
}else {
System.out.println("STAY");
}
}
public static long calc(String temp) {
long ret = 1;
for(int i=0;i<temp.length();i++) {
String charactor = String.valueOf(temp.charAt(i));
int index = CHARACTER.valueOf(charactor).ordinal();
ret *= index;
}
return ret%47;
}
}
import java.util.Scanner;
public class Main{
private static Scanner cin;
public static void main(String args[])throws Exception {
cin = new Scanner(System.in);
String comet = cin.nextLine();
long cometNum = calc(comet);
String team = cin.nextLine();
long teamNum = calc(team);
if( cometNum == teamNum) {
System.out.println("GO");
}else {
System.out.println("STAY");
}
}
public static long calc(String temp) {
long ret = 1;
for(int i=0;i<temp.length();i++) {
String charactor = String.valueOf(temp.charAt(i));
int index = CHARACTER.valueOf(charactor).ordinal();
ret *= index;
}
return ret%47;
}
}
本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。