这段代码存在一些错误:

  1. 在循环中,应该使用i来索引数组ab,而不是N
  2. 在循环中,应该将b[i]赋值为int.Parse(a[i]),而不是b[i] = int.Parse(a[i])
  3. 在循环结束后,需要使用i来索引数组str,而不是固定的索引值。
  4. 最后一行的Console.ReadKey()可以省略。

修正后的代码如下:

using System;

namespace t1_3_evolution
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] str = new string[N];
            for (int i = 0; i < N; i++)
            {
                string number = Console.ReadLine();
                string[] a = number.Split(' ');
                int[] b = new int[3];
                for (int j = 0; j < 3; j++)
                {
                    b[j] = int.Parse(a[j]);
                }
                if (b[0] * b[1] == b[2])
                {
                    str[i] = 'LvYan';
                }
                else if (b[0] + b[1] == b[2])
                {
                    str[i] = 'TuDou';
                }
                else
                {
                    str[i] = 'who?';
                }
            }
            for (int i = 0; i < N; i++)
            {
                Console.WriteLine(str[i]);
            }
        }
    }
}

原文地址: https://www.cveoy.top/t/topic/pkrV 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录