问题描述
民间!我需要实现功能 static bool CheckSectionsIntersect ,以检查各节是否相交(右→;左←;向下↓; ↑)。以连续方向的形式给出N个固定尺寸的连续垂直和水平截面的列表。我不得不认为我会有N条路线。 如果我到过以前,该函数应该返回True。 例如:
N = 6:{上,左,下,下,右,上} –返回True。
⬇⬅
⬇⬆ <- Start
➡⬆
N = 4:{向下,向左,向上,向左}-返回False。
⬅⬇ <- Start
⬆⬅
我写的代码是不完整的,因为我需要对函数的功能提出一些建议:
static void Main()
{
string userInput = Console.ReadLine();
int numberOfSections = Convert.ToInt32(userInput);
string[] sectionDirection = new string[numberOfSections];
for (int i = 0; i < numberOfSections; i++)
{
sectionDirections[i] = Console.ReadLine();
}
Console.WriteLine(CheckSectionsIntersect(sectionDirection,numberOfSections));
}
static bool CheckSectionsIntersect(string[] sectionDirection,int numberOfSections)
{
return true; // I need an implementation here
}
}
}
请问对此实施有什么建议吗? 非常感谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)