import os #数据已改 (-170,-1000),(0,700),(40,940), (300, 2500),(550,7500) def calnum (x1, y1, x2, y2, t):     return int( ((y2-y1)/(x2-x1)) * (t - x1) + y1 ) t =100 x1 , x2 = 0, 0 y1 , y2 = 0, 0      while (True):     t = int( input())     if t < -400:         print("-400")     if t > 1000:         print("1000")     if t < -170:         x1 = -170         y1 = -1000         x2 = 0         y2 = 700         print(calnum(x1, y1, x2, y2, t))     elif t < 0:         x1 = -170         y1 = -1000         x2 = 0         y2 = 700         print(calnum(x1, y1, x2, y2, t))     elif t < 40:         x1 = 0         y1 = 700         x2 = 40         y2 = 940         print(calnum(x1, y1, x2, y2, t))     elif t < 300:         x1 = 40         y1 = 940         x2 = 300         y2 = 2500         print(calnum(x1, y1, x2, y2, t))     elif t < 550:         x1 = 300         y1 = 2500         x2 = 550         y2 = 7500         print(calnum(x1, y1, x2, y2, t))     else:         x1 = 300         y1 = 2500         x2 = 550         y2 = 7500         print(calnum(x1, y1, x2, y2, t))     
点赞 评论

相关推荐

昨天 22:34
已编辑
重庆邮电大学 Java
快手 客户端开发 (n+5)k*16 公积金12
点赞 评论 收藏
分享
牛客网
牛客企业服务