小马1,3代码分享,求分享2的代码,交流讨论~
import math datanum = int(input()) for i in range(datanum): line1 = input().split() for i in range(len(line1)): line1[i] = int(line1[i]) [l0, v0, l1, v1, x0, y0, r, x1, y1] = line1 #当r<x0-x1时,有: if r < x0 - x1: lucheng0 = 1/2 * r *3.14159 +((x0 - r) -x1) #无人车从x0开到x1的距离 t0 = lucheng0 / v0 t_length0 = l0 / v0 #从车头到x1位置,到车尾到x1位置的时间差 t1 = (y1 - (y0 + r)) / v1 t_length1 = l1 / v1 if t_length1 + t1 < t0: #无人车后于测试车通过(case1-1) print('No') elif t_length0 + t0 < t1: #测试车后于无人车通过 (case1-2) print('No') else: print('Yes') #r>x0-x1,有 if r > x0 - x1: y2 = ((r ** 2) - (x1 - x0 + r) ** 2) ** 0.5 + y0 arc0 = math.asin((y2 - y0) / r) #弧度 lucheng0 = arc0 * r #弧长 t0 = lucheng0 / v0 t_length0 = l0 / v0 #从车头到x1位置,到车尾到x1位置的时间差 t1 = (y1 - y2) / v1 t_length1 = l1 / v1 if t_length1 + t1 < t0: #无人车后于测试车通过(case2-1) print('No') elif t_length0 + t0 < t1: #测试车后于无人车通过 (case2-2) print('No') else: print('Yes')#第三题
num = int(input()) l = [] for i in range(num): l.append(int(input())) a1 = l[0] a2 = l[1] a3 = l[2] a4 = l[3] d = (a3 - a1)/2 if (a3 - d)/a2 in [2 ** x for x in range(10)]: for i in range(num): print(int(a1 + i * d)) else: d = (a4 - a2)/2 for i in range(num): print(int(a2 + (i - 1) * d)) #第一题,这个大体思路应该没错,没保存代码,凭记忆写了一遍
#笔试题目#