题解 | #[NOIP2008]ISBN号码#
[NOIP2008]ISBN号码
https://www.nowcoder.com/practice/95712f695f27434b9703394c98b78ee5
public class Program { public static void Main() { string[] line = System.Console.ReadLine().Split("-"); //识别码 int code = 0; if (line[3] == "X") code = 10; else code = int.Parse(line[3]); int Part1 = int.Parse(line[1]); int Part2 = int.Parse(line[2]); int mycode = int.Parse(line[0]) + (Part1 / 100 % 10) * 2 + (Part1 / 10 % 10) * 3 + (Part1 % 10) * 4 + (Part2 / 10000 % 10) * 5 + (Part2 / 1000 % 10) * 6 + (Part2 / 100 % 10) * 7 + (Part2 / 10 % 10) * 8 + (Part2 % 10) * 9; if (mycode % 11 == code) System.Console.WriteLine("Right"); else { if (mycode % 11 == 10) System.Console.WriteLine(line[0] + "-" + line[1] + "-" + line[2] + "-" + "X"); else System.Console.WriteLine(line[0] + "-" + line[1] + "-" + line[2] + "-" + (mycode % 11).ToString()); } } }