码迷,mamicode.com
首页 > 其他好文 > 详细

最优上升值

时间:2020-06-14 16:57:53      阅读:39      评论:0      收藏:0      [点我收藏+]

标签:tar   array   for   span   code   target   index   targe   pre   

 1 array = [[0,0],[1,20],[2,40],[3,80],[4,100]]
 2 target = array[-1]
 3 indexMin = 1
 4 
 5 for row in array[0:-1]:
 6     index = (target[0] - row[0]) / (target[1] - row[1])
 7     if(index < indexMin):
 8         indexMin = index
 9         result = row[1]
10 
11 input(result)

 

最优上升值

标签:tar   array   for   span   code   target   index   targe   pre   

原文地址:https://www.cnblogs.com/CaiNongSun/p/13125203.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!