注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
如果有帮助真的求米!!!!不会消耗你的米
很简单的OA题,一共3个,考一个半小时。
第一题:
Write an algorithm which finds out the elements which are largest in a row and smallest in a column in a matrix.
Input
The first line of input consists of two space-separated integersmatrix_row and matrix_col, representing the number of rows in the matrix (N) and the number of columns in the matrix (M), respectively.The next M lines consist of N spaceseparated integers representing the elements of the matrix.
Output
Print a number which is largest in a row and smallest in a column in the given matrix. If no element is found print '-1'.
Example
Input:
2 2
1 2
3 4
Output:
2
Explanation:
The number 2 at index (0,1) is the largest in its row and smallest in its column. So, the output is 2.
你需要完成:
"""
matrix, represents the elements of the matrix of size N*M.
"""
def funcMatrix(matrix):
# Write your code here
return
def main():
#input for matrix
matrix = []
matrix_rows,matrix_cols = map(int, input(is not found anywhere in the grid.So, the output is ["Yes", "Yes", "Yes", "No"].
完成下列的代码
"""
grid, represents the letters in the grid of size N*M.
word, represents the words to be searched of size K.
"""
def funcPuzzle(grid, word):
# Write your code here
return
def main():
#input for grid
grid = []
grid_rows,grid_cols = map(int, input().split())
for idx in range(grid_rows):
grid.append(list(map(str, input().split())))
#input for word
word = []
word_size = int(input())
word = list(map(str,input().split()))
result = funcPuzzle(grid, word)
print(result)
if __name__ == "__main__":
main()
如果有帮助真的求米!!!!不会消耗你的米 |