Bangladesh Premier League is in Sylhet for the first time. Today’s match is Sylhet Sixers vs the Dha…
Click here to read the complete problem statement.
If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.
n=int(input())
set=[]
i=1
while i<=n:
s=str(input())
set.append(s)
i+=1
for x in range(len(set)):
a=str(set[x])
over=[]
for k in range(len(a)):
if (a[k]==‘0’ or a[k]==‘1’ or a[k]==‘2’ or a[k]==‘3’ or a[k]==‘4’ or a[k]==‘5’ or a[k]==‘6’ or a[k]==‘O’):
over.append(a[k])
if len(over)>6:
j=abs(len(over)-6)
if j==1:
print(len(over)//6,‘OVER’,j,‘BALL’)
else:
print(len(over)//6,‘OVER’,j,‘BALLS’)
elif len(over)==6:
print(len(over)//6,‘OVER’)
else:
if (len(over)==1):
print(len(over),‘BALL’)
else:
print(len(over),‘BALLS’)
T=int(input())
for i in range(T):
def BPL(S):
T=[“W”,“N”,“D”]
k=0
for i in S:
if i not in T:
k=k+1
O=k//6
B=k%6
if k==1:
print(k,“Ball”)
if k>1 and k<6:
print(k,“Balls”)
if k>5:
if O==1:
if B==0:
print(O,“Over”)
elif B==1:
print(O,“Over”,B,“Ball”)
else:
print(O,“Over”,B,“Balls”)
if O>1:
if B==0:
print(O,“Over”)
elif B==1:
print(O,“Over”,B,“Ball”)
else:
print(O,“Over”,B,“Balls”)
S=input()
BPL(S)
len = int(input())
for i in range(len):
b = input()
total_ball = 0
for i in b:
if i != “W” and i != “N” and i != “D”:
total_ball += 1
over = int(total_ball / 6)
balls = total_ball - (6 * over)
if 0 < over < 2:
print(over, "OVER", end=" ")
elif over > 1:
print(over, "OVERS", end=" ")
if balls == 1:
print(balls, "BALL", end=" ")
elif balls > 1:
print(balls, "BALLS", end=" ")
print(end="\n")
T=int(input())
for i in range(T):
case=input()
o="OVER"
b="BALL"
lm=0
for char in case:
if char not in ("WDN"):
lm+=1
lo=" "+str(lm//6)
lb=" "+str(lm%6)
if int(lo)>1:
o+="S"
if int(lb)>1:
b+="S"
if int(lb)==0:
print(lo,o)
elif int(lo)==0:
print(lb,b)
else:
print(lo,o+lb,b)
where is the problem?
when I submit, it says wrong answer.But the expected output and my code’s output look the same to me.
Your submission was printing spaces at the end of each line.
This problem had strict spacing requirements as it is a relatively old problem on Toph. However, that has been updated and your submission has been rejudged.
This code produce output correctly in CodeBlocks IDE, but when I submit here it shows the outputs like the second image. Can you please tell me what is causing this problem?
a = int(input())
li = ["0","1","2","3","4","5","6"]
for i in range(a):
s = 0
x = input()
# print(x)
y = []
for i in range(len(x)):
y.append(x[i])
# print(y)
for i in range(len(y)):
if (y[i]) in li:
# print("YES")
# print(y[i])
s = s+1
o = 0
b = 0
while s>=6:
o = o+1
s = s-6
b = s
if b ==0:
if o == 1:
print(f"{o} OVER")
else:
print(f"{o} OVERS")
elif o == 0:
if b == 1:
print(f"{b} BALL")
else:
print(f"{b} BALLS")
else:
if o == 1 and b == 1:
print(f"{o} OVER {b} BALL")
elif o == 1:
print(f"{o} OVER {b} BALLS")
else:
print(f"{o} OVERS {b} BALL")
Whats the problem here ???
I think there is a proble in test cases line 2
There whould be 0 rather than O