
算法
ajianchina
这个作者很懒,什么都没留下…
展开
-
闭环最短路径算法
适用于闭环状态下各节点间距相等,计算从其中一个节点去1个或多个目标节点的最短路径,最短路径可以折返取得。下面是一个有着10000个节点的闭环,从其中一个节点去往9个目标节点的示例。static void Main(string[] args){ int x = 3;//起点 int[] arr = { 2, 2000, 4900, 9990, 6001, 200, 400原创 2015-06-11 14:47:02 · 2383 阅读 · 0 评论 -
c# C(m,n) 排列组合算法
class Program { static void Main(string[] args) { string[] sArr = new string[] { "a", "b", "c", "d", "e" }; List outList = addList(sArr.Select(p => new stri原创 2015-06-04 23:36:55 · 10416 阅读 · 3 评论 -
c#泛型冒泡排序法
public delegate bool Contrast(T t1, T t2);public static void Sequence(T[] items, Contrast contrast){ for (int i = 0; i < items.Length; i++) { for (int j = i + 1; j < items.Length; j+原创 2015-09-13 00:56:33 · 2557 阅读 · 0 评论 -
机动车车辆识别代码(车架号)校验函数
public static bool CheckVin(string vin){ if (vin == null || vin.Length != 17) return false; int symbol, weight, verify, sum = 0; bool isRepeat = true; if (vin[8] >= 48 && ...原创 2017-04-18 13:39:51 · 7093 阅读 · 2 评论 -
统一社会信用代码c#校验函数
public static bool CheckSocialCreditCode(string code){ if (code?.Length != 18) return false; code = code.ToUpper(); int[] factor = { 1, 3, 9, 27, 19, 26, 16, 17, 20, 29, 25, 13, 8,原创 2017-05-03 16:40:32 · 4420 阅读 · 2 评论