在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
public string zz(string a, string b) { char[] chara = a.ToCharArray(); char[] charb = b.ToCharArray(); int[] inta = Array.ConvertAll(chara, new Converter<char, int>(delegate(char g) { return int.Parse(g.ToString()); })); int[] intb = Array.ConvertAll(charb, new Converter<char, int>(delegate(char g) { return int.Parse(g.ToString()); })); int x = a.Length; int y = b.Length; int[] c = new int[x + y]; while (x > 0) { x--; y = b.Length; while (y > 0) { y--; c[x + y + 1] = c[x + y + 1] + inta[x] * intb[y]; } } string f = string.Join("", Array.ConvertAll(zzz(c, c.Length - 1), new Converter<int, string>(delegate(int g) { return g.ToString(); }))); return f.Substring(0, 1).Replace("0", "") + f.Substring(1, f.Length - 1); } public int[] zzz(int[] arr, int n) { if (n > 0) { arr[n - 1] += arr[n] / 10; arr[n] %= 10; return zzz(arr, n - 1); } return arr; } |
请发表评论