def get_max_time(normal = '', large = ''): normal_tuple = normal.split() large_tuple = large.split() max_time = 100 #资材100x for i, j in zip(normal_tuple, large_tuple): time_this = int(int(j) / int(i)) max_time = min(time_this, max_time) return max_time def get_max_time_round(normal, large): #normal_tuple = normal.split() #large_tuple = large.split() max_time = 20 #资材20 for i, j in zip(normal, large): time_this = int(int(j) / int(i)) #print(time_this) if 1 < abs(max_time - time_this) < 2: #差一次没啥 max_time = int((max_time + time_this) / 2) else: max_time = min(max_time, time_this + 1) return max_time #---------------------------------------------------------------------- def calc_difference(normal = '', large = '', max_time = 0): """""" normal_tuple = [int(i) for i in normal.split()[:5]] large_tuple = [int(i) for i in large.split()[:5]] if max_time == 0: max_time = get_max_time_round(normal_tuple, large_tuple) #list_this = [] print('\t'.join([str(max_time)] + [str(i * max_time - j) for i, j in zip(normal_tuple, large_tuple)])) #---------------------------------------------------------------------- def calc_difference2(normal = '', large = '', max_time = 0): """""" normal_tuple = [int(i) for i in normal.split()[:5]] large_tuple = [int(i) for i in large.split()[:5]] if max_time == 0: max_time = get_max_time_round(normal_tuple, large_tuple) #list_this = [] return '\t'.join([str(max_time)] + [str(i * max_time - j) for i, j in zip(normal_tuple, large_tuple)]) #---------------------------------------------------------------------- def get_chance(chance_normal, time): """""" print(str(round(100 - ((1 - chance_normal / 100) ** time) * 100, 2)) + '%') #---------------------------------------------------------------------- def get_chance2(chance_normal, time): """""" return str(round(100 - ((1 - chance_normal / 100) ** time) * 100, 2)) + '%' #---------------------------------------------------------------------- def calc_chance(start, end, chance): """""" for i in range(start, end + 1): print(get_chance2( 0.93, i)) #---------------------------------------------------------------------- def calc_difference_multiple(normal = '', large = '', max_time = 0): """""" normal_tuple = [int(i) for i in normal.split()[:5]] large_tuple = [int(i) for i in large.split()[:5]] if max_time == 0: max_time = get_max_time_round(normal_tuple, large_tuple) for i in range(max_time - 2, max_time + 1): print(calc_difference2(normal, large, i))