米第二题,记录一下
有空检查一下还有哪里有纰漏,过了90,想了一天也没想通。。
import string import sys from copy import copy def normalDamage(att,defend): if att-defend>=0: return att-defend else: return 0 def yuanSuDamae(att): return att def qjgetMoreAtt(qjOriginHp,qjTmpHp,qjOriginAtt): dif=0 if qjOriginHp>=qjTmpHp: dif=qjOriginHp-qjTmpHp else: dif=0 morAtt=dif//5 resAtt=qjOriginAtt+morAtt return resAtt def roundCurrent(list1,list2): qjOriginHp=copy(list2[0]) qjOriginAtt=copy(list2[1]) wewHp=list1[0] wewAtt=list1[1] wewDef=list1[2] wewSpd=list1[3] qjHp=list2[0] qjAtt=list2[1] qjDef=list2[2] qjSpd=list2[3] round=0 wewZhudong=0 qjZhudong=0 qjIsXiuXi=0 qjIsHunLuan=0 wewBeidongIsUsed=0 while wewHp>0 and qjHp>0: round+=1 #wew优先 if wewSpd>qjSpd: #wew的回合 if round%3==0: wewZhudong=1 qjZhudong=1 else: wewZhudong=0 qjZhudong=0 if wewBeidongIsUsed==0: if wewHp<31: wewHp+=20 qjHp+=20 wewAtt+=15 wewBeidongIsUsed=1 if wewZhudong==0: damage=normalDamage(wewAtt,qjDef) qjHp-=damage if qjHp<=0: return 0 else: damage=normalDamage(wewAtt,qjDef) qjHp-=damage qjIsHunLuan=1 if qjHp<=0: return 0 #qj的回合 if qjIsXiuXi==1: qjIsXiuXi=0 else: resAtt=qjgetMoreAtt(qjOriginHp,qjHp,qjOriginAtt) qjAtt=resAtt if qjZhudong==0&nbs***bsp;(qjZhudong==1 and qjHp<11): if qjIsHunLuan==1: damage=normalDamage(qjAtt,qjDef) qjHp-=damage if qjHp<=0: return 0 else: damage=normalDamage(qjAtt,wewDef) wewHp-=damage if wewHp<=0: return 1 else: qjHp-=10 damage=normalDamage(45,wewDef)+20 wewHp-=damage if wewHp<=0: return 1 qjIsXiuXi=1 #qj优先 else: #qj的回合 if qjIsXiuXi==1: qjIsXiuXi=0 else: resAtt=qjgetMoreAtt(qjOriginHp,qjHp,qjOriginAtt) qjAtt=resAtt if qjZhudong==0&nbs***bsp;(qjZhudong==1 and qjHp<11): if qjIsHunLuan==1: damage=normalDamage(qjAtt,qjDef) qjHp-=damage if qjHp<=0: return 0 else: damage=normalDamage(qjAtt,wewDef) wewHp-=damage if wewHp<=0: return 1 else: qjHp-=10 damage=normalDamage(45,wewDef)+20 wewHp-=damage if wewHp<=0: return 1 qjIsXiuXi=1 #wew的回合 if round%3==0: wewZhudong=1 qjZhudong=1 else: wewZhudong=0 qjZhudong=0 if wewBeidongIsUsed==0: if wewHp<31: wewHp+=20 qjHp+=20 wewAtt+=15 wewBeidongIsUsed=1 if wewZhudong==0: damage=normalDamage(wewAtt,qjDef) qjHp-=damage if qjHp<=0: return 0 else: damage=normalDamage(wewAtt,qjDef) qjHp-=damage qjIsHunLuan=1 if qjHp<=0: return 0 times = int(input()) for i in range(times): list1=list(map(int,input().strip().split())) # print(list1) list2=list(map(int,input().strip().split())) # print(list2) res=roundCurrent(list1,list2) if res==0: print("I love V2V forever!") else: print("Kalpas yame te!")