数据结构第四章作业
This commit is contained in:
		
							parent
							
								
									02db0f35cc
								
							
						
					
					
						commit
						46a9c0e9e3
					
				
							
								
								
									
										
											BIN
										
									
								
								作业/数据结构-金健/10213903403第四章作业.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								作业/数据结构-金健/10213903403第四章作业.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										20
									
								
								作业/数据结构-金健/Python/第四章作业4.1.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								作业/数据结构-金健/Python/第四章作业4.1.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,20 @@
 | 
			
		||||
def reverse(matrix):
 | 
			
		||||
    return matrix and list(matrix[0]) + reverse(list(zip(*matrix[1:]))[::-1])
 | 
			
		||||
print(reverse([line.split() for line in __import__("sys").stdin.readlines()]))
 | 
			
		||||
 | 
			
		||||
# 输入:
 | 
			
		||||
# 1 2 3
 | 
			
		||||
# 4 5 6
 | 
			
		||||
# 7 8 9
 | 
			
		||||
# * 0 #
 | 
			
		||||
# ^Z
 | 
			
		||||
# 输出:
 | 
			
		||||
# ['1', '2', '3', '6', '9', '#', '0', '*', '7', '4', '5', '8']
 | 
			
		||||
 | 
			
		||||
# 输入:
 | 
			
		||||
# 西北    北      东北
 | 
			
		||||
# 西      中      东
 | 
			
		||||
# 西南    南      东南
 | 
			
		||||
# ^Z
 | 
			
		||||
# 输出:
 | 
			
		||||
# ['西北', '北', '东北', '东', '东南', '南', '西南', '西', '中']
 | 
			
		||||
							
								
								
									
										30
									
								
								作业/数据结构-金健/Python/第四章作业4.2.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								作业/数据结构-金健/Python/第四章作业4.2.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,30 @@
 | 
			
		||||
# 13:23
 | 
			
		||||
# 13:47
 | 
			
		||||
 | 
			
		||||
# pprint是第三方库,这里暂时不使用
 | 
			
		||||
 | 
			
		||||
raw = input() # 下标从0开始
 | 
			
		||||
_ = [print(part, f"\t位置为[{i}, {j + 1}]") for j in range(1, len(raw)) for i in range(0, j) if (part := raw[i:j + 1]) == part[::-1]]
 | 
			
		||||
 | 
			
		||||
# 输入:
 | 
			
		||||
# cccdeedccc
 | 
			
		||||
# 输出:
 | 
			
		||||
# cc      位置为[0, 2]
 | 
			
		||||
# ccc     位置为[0, 3]
 | 
			
		||||
# cc      位置为[1, 3]
 | 
			
		||||
# ee      位置为[4, 6]
 | 
			
		||||
# deed    位置为[3, 7]
 | 
			
		||||
# cdeedc  位置为[2, 8]
 | 
			
		||||
# ccdeedcc        位置为[1, 9]
 | 
			
		||||
# cc      位置为[7, 9]
 | 
			
		||||
# cccdeedccc      位置为[0, 10]
 | 
			
		||||
# ccc     位置为[7, 10]
 | 
			
		||||
# cc      位置为[8, 10]
 | 
			
		||||
 | 
			
		||||
# 输入:
 | 
			
		||||
# 上海自来水来自海上
 | 
			
		||||
# 输出:
 | 
			
		||||
# 来水来  位置为[3, 6]
 | 
			
		||||
# 自来水来自      位置为[2, 7]
 | 
			
		||||
# 海自来水来自海  位置为[1, 8]
 | 
			
		||||
# 上海自来水来自海上      位置为[0, 9]
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user