horse1 = [10,20,30]
h1=int(input("请输入第1批马子的能力值"))
h2=int(input("请输入第2批马子的能力值"))
h3=int(input("请输入第3批马子的能力值"))
h=[h1,h2,h3]
#30 30 *
if (h[1]==horse1[2] and h[2]==horse1[2]):
print(str(h[1]) + 'vs' + str(horse1[0]))
print(str(h[2]) + 'vs' + str(horse1[1]))
print(str(h[0]) + 'vs' + str(horse1[2]))
elif (h[0]==horse1[2] and h[1]==horse1[2]):
print(str(h[0]) + 'vs' + str(horse1[0]))
print(str(h[1]) + 'vs' + str(horse1[1]))
print(str(h[2]) + 'vs' + str(horse1[2]))
elif (h[0] == horse1[2] and h[2] == horse1[2]):
print(str(h[0]) + 'vs' + str(horse1[0]))
print(str(h[2]) + 'vs' + str(horse1[1]))
print(str(h[1]) + 'vs' + str(horse1[2]))
#20 30 *
elif (h[0]==horse1[1] and h[1]==horse1[2]):
print(str(h[0]) + 'vs' + str(horse1[0]))
print(str(h[1]) + 'vs' + str(horse1[1]))
print(str(h[2]) + 'vs' + str(horse1[2]))
elif (h[0]==horse1[2] and h[1]==horse1[1]):
print(str(h[0]) + 'vs' + str(horse1[1]))
print(str(h[1]) + 'vs' + str(horse1[0]))
print(str(h[2]) + 'vs' + str(horse1[2]))
elif (h[0] == horse1[2] and h[2] == horse1[1]):
print(str(h[0]) + 'vs' + str(horse1[1]))
print(str(h[1]) + 'vs' + str(horse1[2]))
print(str(h[2]) + 'vs' + str(horse1[0]))
elif (h[0] == horse1[1] and h[2] == horse1[2]):
print(str(h[0]) + 'vs' + str(horse1[0]))
print(str(h[1]) + 'vs' + str(horse1[2]))
print(str(h[2]) + 'vs' + str(horse1[1]))
elif (h[1] == horse1[2] and h[2] == horse1[1]):
print(str(h[0]) + 'vs' + str(horse1[2]))
print(str(h[1]) + 'vs' + str(horse1[0]))
print(str(h[2]) + 'vs' + str(horse1[1]))
elif (h[1] == horse1[1] and h[2] == horse1[2]):
print(str(h[0]) + 'vs' + str(horse1[2]))
print(str(h[1]) + 'vs' + str(horse1[1]))
print(str(h[2]) + 'vs' + str(horse1[0]))
else:
print("无法取胜")
十、田忌赛马策略:故意让最弱的马输给对方最强的马,然后其他两匹马设法取胜。 设有三匹马,能力值分别为10,20,30。输入任意三匹马的能力值,若这三匹马有可能取胜,输出能取胜的三场对阵表,若无论如何
最新推荐文章于 2024-07-12 16:16:27 发布