In a remote location, a student is watching a game of ODI cricket on TV. At some point, power goes off; the student is assured about the current run rate of the batting team, which batsman is on strike and individual scores of both the batsmen playing currently but is unsure of exact number of runs the batting team has scored. After some time, power is restored for a moment and at that point in time, a Timeline of runs scored in last D no. of deliveries and current run rate is being shown on TV. Exactly D no. of deliveries were bowled in between the power outage. Given these details, you need to find out the total number of runs scored by the team and score of batsmen currently playing. Wickets falling will be shown as W. Assume batsmen can only be 'bowled' in these D deliveries Consequent overs are bowled from opposite ends. (ie. batsmen change sides at the end of an over)
Answers
Answered by
0
Answer:
rr1 = float(input())
b1,b2 = list(map(int,input().split()))
d = list(input().split())
rr2 = float(input())
score_d = 0
for i in d:
if i== 'W':
continue
score_d += int(i)
b =int( ((rr2*len(d))-(6*score_d))//(rr1-rr2))
score = int(rr1 * b //6)
#print(score,b)
current_score = score+score_d
if b%6==0:
b1,b2=b2,b1
total_balls = b+len(d)
for i in range(b+1,total_balls+1):
if d[i-b-1]=='W':
b1=0
else:
b1 += int(d[i-b-1])
if i%6==0:
b1,b2=b2,b1
print(current_score,end=" ")
print(b1,end=" ")
print(b2,end=" ")
Explanation:
Similar questions