- ISBN号码
- 2019-03-02 13:16:51 @
理论上是没问题的啊
却提示说q是一个String,不是String玩个屁啊。
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
int he = 0;
String Shibiema = "";
Scanner sc = new Scanner(System.in);
String c = sc.nextLine();
String q = c;
q.deleteCharAt(q.length()-1);
String allNum = c.replace("-", "");
allNum.deleteCharAt(c.length()-1);
String LAST = String.valueOf(allNum.charAt(c.length() - 1));
for(int i=0; i<allNum.length(); i++) {
String thisn = String.valueOf(allNum.charAt(i));
int chengji = Integer.valueOf(thisn) * (i+1);
he += chengji;
}
int yushu = he%11;
if(yushu == 10) {
Shibiema = "X";
} else {
Shibiema = String.valueOf(yushu);
}
if(Shibiema == LAST) {
System.out.println("Right");
} else {
String theRightCode = q + Shibiema;
System.out.println(theRightCode);
}
}
}
0 条评论
目前还没有评论...