1. 火車票上*號打的是月,日,理論上的有最大366種組合;
2. 校驗碼是最后的一位,0-9及X,11個結果;
3. 那么,通過火車票上的身份證號,可以得到33個左右真正的有效身份證號;
4. 如果你能知道對方的星座(嗯,大家不是經常曝自己是什么星座么),那么,再將這30多個結果映射到12個星座中,最終可能性只有2-3個。。。
5. 結論:曬車票,一定要打碼
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;// 返回索引指向的星座stringreturn starArr[index];}}} 新聞熱點
疑難解答