1、
import sys input_data,del_pos= sys.stdin.readline().strip().split() try: data = int(input_data) pos = int(del_pos) if pos > 8: pos = 'a' pos = int(pos) if len(input_data)==8: input_data = input_data[:pos-1]+input_data[pos:] data = [] for i in input_data: data.append(i) data = sorted(data,reverse=True) ans = '' for k in data: ans = ans+k print(int(ans)) else: print("error") except: print("error")
2、
import sys nums = [] for i in range(4): l = [] for j in range(4): num = int(sys.stdin.readline().strip()) l.append(num) # print(l) nums.append(l) for i in range(4): for j in range(4): num = nums[i][j] if i == 0: num2 = nums[i][j-1] if j == 0: continue else: nums[i][j] = num+num2 # print(nums[i][j]) elif j == 0: num1 = nums[i-1][j] nums[i][j] = num + num1 else: num1 = nums[i-1][j] num2 = nums[i][j-1] if num1 < num2: nums[i][j] = num+num1 else: nums[i][j] = num+num2 print(nums[3][3])
全部评论
(2) 回帖