import java.util.*;
public class a020 {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
while(scanner.hasNext()){
String input=scanner.nextLine();
String []array;
int add=0;
array=input.split("");
switch(array[0]){
case "A" :add=1+0*9;break;
case "B" :add=1+1*9;break;
case "C" :add=1+2*9;break;
case "D" :add=1+3*9;break;
case "E" :add=1+4*9;break;
case "F" :add=1+5*9;break;
case "G" :add=1+6*9;break;
case "H" :add=1+7*9;break;
case "I" :add=3+4*9;break;
case "J" :add=1+8*9;break;
case "K" :add=1+9*9;break;
case "L" :add=2+0*9;break;
case "M" :add=2+1*9;break;
case "N" :add=2+2*9;break;
case "O" :add=3+5*9;break;
case "P" :add=2+3*9;break;
case "Q" :add=2+4*9;break;
case "R" :add=2+5*9;break;
case "S" :add=2+6*9;break;
case "T" :add=2+7*9;break;
case "U" :add=2+8*9;break;
case "V" :add=2+9*9;break;
case "W" :add=3+2*9;break;
case "X" :add=3+0*9;break;
case "Y" :add=3+1*9;break;
case "Z" :add=3+3*9;break;
}//switch
int as[]=new int [9];
for(int i=0;i<9;i++){
as[i]=Integer.parseInt(array[(i+1)]);
}//for
for(int i=0;i<9;i++){
switch(i){
case 0:add+=(as[i]*8);break;
case 1:add+=(as[i]*7);break;
case 2:add+=(as[i]*6);break;
case 3:add+=(as[i]*5);break;
case 4:add+=(as[i]*4);break;
case 5:add+=(as[i]*3);break;
case 6:add+=(as[i]*2);break;
case 7:add+=(as[i]*1);break;
case 8:add+=(as[i]);break;
}//switch
}//for
if(add%10==0)System.out.println("real");else System.out.println("fake");
}//while
}//main
}//class
==
您的程式被監控系統中斷,可能是程式無法正常結束所導致。 Exception in thread "main" java.lang.NumberFormatException: For input string: "T" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:492) at java.lang.Integer.parseInt(Integer.java:527) at code_2680494.math(code_2680494.java:50) at code_2680494.main(code_2680494.java:12)
==
小弟換寫法過了這題,還是想問大大,這題RE問題如何改或漏了什麼觀念?