Hello,
I am repeatedly getting WA for Test Set - 1 on submitting my code. (Note:
Sample test data input produces the expected output)
But when I tried to simulate the Test Set 1 by entering the inputs manually
with “Test run mode” on , there was no issue. I am unable to debug any
further because there is no further description apart from WA.
*I am stuck.Any help is appreciated.*
Below is my code in Python:
T=int(input())
def tidy(num):
l=len(num)
sNum = set(num)
tSet = {'1','0'}
if len(sNum) == 1:
return num
elif int(num[0]) == 9:
return "8"+(l-1)*"9"
elif sNum == tSet:
return "9"*(l-1)
else:
t=""
for i in range(0,l):
iN = int(num[i])
if iN > int(num[i+1]):
if iN-1 != 0:
t = t + str(iN-1)
return (t + "9" * (l-i-1))
else:
t = t+num[i]
if i == l - 2:
break
return num
for i in range(T):
num = input()
print("Case #{}: {}".format(i+1, tidy(num)))
Thanks
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/4ae87e3c-3dee-45bd-9d03-922581734b7cn%40googlegroups.com.