c#编程两个乒乓球队
答案:1 悬赏:30 手机版
解决时间 2021-03-28 13:31
- 提问者网友:趣果有间
- 2021-03-27 21:17
c#编程两个乒乓球队
最佳答案
- 五星知识达人网友:西风乍起
- 2021-03-27 22:44
string[] team1 = new string[3];
string[] team2 = new string[] { "x", "y", "z" };
team1[2] = team2.First(x => x != "x" && x != "z");
foreach (string item in team2)
{
for (int index = 0; index < team1.Length; index++)
{
if (item == "x" && index == 0)
{
continue;
}
if (team1.All(x => x != item) && team1[index] == null)
team1[index] = item;
}
}
Console.WriteLine("{0}", string.Join("
", team1));
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯