1. The * number on the train ticket is the month and day. Theoretically, there are a maximum of 366 combinations; 2. The check code is the last digit, 0-9 and X, 11 results; 3. Then , through the ID number on the train ticket, you can get about 33 real valid ID numbers; 4. If you can know the other person’s zodiac sign (well, don’t everyone often reveal what zodiac sign they are), then,
1. The * number on the train ticket indicates the month and day. In theory, there are a maximum of 366 combinations;
2. The check code is the last digit, 0-9 and X, 11 results;
3. Then, through the ID number on the train ticket, you can get about 33 real valid ID numbers;
4. If you can know the other person’s zodiac sign (well, don’t we often reveal what zodiac sign we are), then map these 30-plus results to 12 zodiac signs, and the final possibility is only 2-3 . . .
5. Conclusion: When posting tickets, be sure to code them
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Geyunfei.CheckID { class PRogram { static int[] a = new int[] { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 }; static char[] b = new char[] { '1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2' }; static int index = 0; static void Main(string[] args) { System.Console.WriteLine("输入火车票上的身份证号:"); String a = System.Console.ReadLine(); var year = int.Parse(a.Substring(6, 4)); var beginDate = new DateTime(year, 1, 1); var chk = a.Substring(14); int days = 365; if (DateTime.IsLeapYear(year)) days++; for(int i =0;i<days; i++) { var chkDate = beginDate.AddDays(i).ToString("MMdd"); var id = a.Substring(0, 10) + chkDate + chk; CheckID(id); } } private static void CheckID(string id) { int sum = 0; for(int i = 0; i < 17; i++) { sum += int.Parse(id[i].ToString()) * a[i]; } var chk = b[sum % 11]; if (chk == id[17]) { index++; Console.WriteLine(getAstro(int.Parse(id.Substring(10,2)),int.Parse(id.Substring(12,2)))+ index.ToString() +" "+id); } } private static String getAstro(int month, int day) { String[] starArr = {"魔羯座","水瓶座", "双鱼座", "牡羊座", "金牛座", "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", "天蝎座", "射手座" }; int[] DayArr = { 22, 20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22 }; // 两个星座分割日 int index = month; // 所查询日期在分割日之前,索引-1,否则不变 if (day < DayArr[month - 1]) { index = index - 1; } index = index % 12; // 返回索引指向的星座string return starArr[index]; } } }