如何在C#中将Int类型变量转换为List <int>?

时间:2019-05-24 15:14:15

标签: c#

假设两个列表是a和b。我正在比较a [0]> b [0],count_alice将为1。然后需要将此int类型count_alice变量转换为List类型。我该如何解决?

static List<int> CompareTriplets(List<int> a, List<int> b)
{
        int count_alice = 0;
        int count_bob = 0;


        for(int i = 0; i<a.Count; i++)
        {
            if(a[i]>b[i])
            {
                count_alice += 1;
            }
            else if (a[i]<b[i])
            {
                count_bob += 1;
            }
        }
        return a;

0 个答案:

没有答案