题解 | #[NOIP2008]ISBN号码#
[NOIP2008]ISBN号码
http://www.nowcoder.com/practice/95712f695f27434b9703394c98b78ee5
import java.util.Scanner; import java.lang.String; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] isbn=sc.nextLine().split("-");//分开 int one=Integer.parseInt(isbn[0]); int two=Integer.parseInt(isbn[1]); int three=Integer.parseInt(isbn[2]); int count1=one*1; int count2=(two/100)*2+(two%100/10)*3+(two%10)*4; int count3=(three/10000)*5+(three%10000/1000)*6+(three%1000/100)*7+(three%100/10)*8+(three%10)*9; int count=(count1+count2+count3)%11; if(count==10) { if(isbn[3].equals("X")) { System.out.println("Right"); }else{ System.out.println(one+"-"+two+"-"+three+"-X"); } }else{ if(isbn[3].equals(String.valueOf(count))) { System.out.println("Right"); }else{ System.out.println(one+"-"+two+"-"+three+"-"+count); } } } }