Hi,

I can give you some input that your solution will fails to handle

try
*221*

your code produce *219*, which is not a tidy number

在2021年3月2日星期二 UTC-8 上午8:18:15<[email protected]> 写道:

> 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/5d9216cc-194b-4f00-a095-c4f14ea9232dn%40googlegroups.com.

Reply via email to