List<int> num = new List<int>{2,4,9,3,7};List<int> a = new List<int>{2,3,4,9};List<int> b = new List<int>{2,3,4,5};a 与 num的交集 结果= 4,  b 与 num 的交集结果 = 3我用except 似乎不对,错在哪里了呢?num.Except(a).Count() == 1
num.Execpt(b).Count() == 2

解决方案 »

  1.   

    except是指num中存在而a中不存在的
      

  2.   

    List<int> num1 = new List<int>{2,4,9,3,7};List<int> num2 = new List<int>{2,3,4,9,6};List<int> b = new List<int>{2,3,4,5};判断: 只要,b 与 num1 的交集数量 >= 3就成立
    我用except 似乎不对,错在哪里了呢?num1.Except(b).Count() > 1
    num2.Except(b).Count() > 1
      

  3.   

    (num1.Except(b).Count()-b.Count)>=3
      

  4.   

    上面不对
    (num1.Count-num1.Except(b).Count())>=3
      

  5.   

    先对num排序 List<int> num = new List<int> { 2, 4, 9, 3, 7 };            List<int> a = new List<int> { 2, 3, 4, 9 };            List<int> b = new List<int> { 2, 3, 4, 5 };
                num.Sort();
                int count1=num.Intersect(a).Count();
                int count2 = num.Intersect(b).Count();
      

  6.   

    Intersect 取交集
    不用排序的
      

  7.   

    Except取得的是不重复的数据,而不是重复的数据,反了