1.4 Given two squares on a two dimensional plane, find a line that would cut these two squares in half.
思路很简单,连接两个正方形的中心,线段所在的直线即满足要求。
需要注意,如果两个正方形的中心重合,程序应该考虑到。
SUGGESTIONS AND OBSERVATIONS
The main point of this problem is to see how careful you are about coding. It’s easy to glance
over the special cases (eg, the two squares having the same middle). Make a list of these special
cases before you start the problem and make sure to handle them appropriately.
本文探讨了如何在二维平面上找到一条直线,该直线能够同时将两个正方形精确地分成两半。解决方法十分直观:只需连接两个正方形中心,这条线段所在的直线即可满足需求。特别注意的是,当两个正方形的中心重合时,解决方案仍适用。
28

被折叠的 条评论
为什么被折叠?



