一亩三分地论坛

 找回密码
 Sign Up 注册获取更多干货
码农求职神器Triplebyte:
不用海投,内推多家公司面试
Airbnb 数据科学职位
in analytics and inference
游戏初创公司
招聘工程师、Designer和游戏策划
游戏初创公司DreamCraft招聘工程师、UIUX Designer和游戏策划
电商初创公司Good Days
招聘SDE/UI/TPM实习生
把贵司招聘信息放这里
查看: 411|回复: 0
收起左侧

[找工就业] 一道OA题目 求思路

[复制链接] |试试Instant~ |关注本帖
snakefly 发表于 2016-2-4 11:30:22 | 显示全部楼层 |阅读模式

2016(4-6月)-[15]CS硕士+fresh grad 无实习/全职 - Other| 码农类其他@fresh grad应届毕业生

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看,没有帐号?Sign Up 注册获取更多干货

x
来自codeassess  求这里的OA tips..1point3acres缃
问题如下:
. 1point3acres.com/bbs

.鏈枃鍘熷垱鑷1point3acres璁哄潧
鏉ユ簮涓浜.涓夊垎鍦拌鍧.
Write a program that takes one integer N and an array of N * N elements (the first line contains the integer N and the next N lines contain N integers each, representing the two dimensional array). Your program should give as output the size of the maximum square array (an array of size M * M) that is a magic square and is a sub-array of the inputted array. A magic square is a square of numbers such that when you pick any set of N cells from that square, each cell from the set doesn't share a row or a column with any other cell from that set, and the sum of those N cells is the same for each such possible set of cells.


Example

Case 1:

For the input provided as follows:

. 1point3acres.com/bbs2. visit 1point3acres.com for more.
23 40
9 26.鏈枃鍘熷垱鑷1point3acres璁哄潧
.鐣欏璁哄潧-涓浜-涓夊垎鍦
Output of the program will be:
. visit 1point3acres.com for more.
2

Description:
-google 1point3acres
As 23 + 26 is equal to 40 + 9, the inputted array is a magic square, giving us a maximum answer of 2.

Case 2:

For the input provided as follows:
. more info on 1point3acres.com
4
-41 -29 2 1. 鐗涗汉浜戦泦,涓浜╀笁鍒嗗湴
28 40 71 2
11 23 54 3
4 5 6 7 8. 1point3acres.com/bbs

Output of the program will be:

3

Description:
-google 1point3acres
As the inputted array is not a magic square, the answer can not be 4. Looking at all the possible square arrays, we can check that the maximum answer is 3 with the following 3 x 3 array:

-41 -29 2
28 40 71
11 23 54.1point3acres缃

本版积分规则

关闭

一亩三分地推荐上一条 /5 下一条

手机版|小黑屋|一亩三分地论坛声明

custom counter

GMT+8, 2018-1-23 00:23

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

快速回复 返回顶部 返回列表