科迪< / p >
这个问题有时被称为17x17挑战。Part 1 and Part 2这次,你的任务是,对于给定的n,构造一个n × n的矩阵其中没有矩形。当矩阵的矩形区域的角上出现四个相同值的实例时,就形成了矩形。< / p >
Examples:
Input n = 3
Output a = [ 4 1 2 1 4 3 2 1 1 ]
Input n = 5 Output a = [ 4 1 2 4 1 3 3 2 1 4 3 2 4 1 1 1 4 3 2 2 1 1 1 4 4 ]
The answer for a given n is not unique. The test suite will just guarantee that there are no rectangles present.
Note 1. I am using Alfonso's solution 191508 from problem 514 as my testing code. Cody in the service of Cody!
Note 2. You can easily answer this problem with a pre-computed response. You could do that, but it would be lame. We want to see your code!
解决方案434015
见问题描述中的注2。< / p >
找到回文
解决774< / p >
找到不旋转的多米诺骨牌的完美位置(更容易)
解决256< / p >
如何添加?
100个求解器< / p >
设置一个对角
解决171< / p >
用1替换非零号码
210个求解器< / p >
穿越到亲吻-解开线路
26日解决< / p >
最长的质数对角线有多长?
解决351< / p >
制作一个行程长度的同伴向量
解决548< / p >
斐波那契分解
222个求解器< / p >
那个进球是什么时候进的?
解决78< / p >
找到Matlab Central中的宝藏,并发现社区如何帮助您!< / p >开始狩猎!
选择一个网站,在那里获得翻译的内容,并看到当地的活动和优惠。根据您的位置,我们建议您选择:.< / p >选择网站
你也可以从以下列表中选择一个网站:< / p >
选择中国网站(中文或英文)以获得最佳网站性能。其他MathWorks国家站点没有针对您所在位置的访问进行优化。< / p >
与当地办事处联系