Https://www.codechef.com/viewsolution/30842062
It’s my solution link for SWPDGT
can someone tell me the mistake with my code…
Really can’t understand my mistake now also…will be thankful to you for my help with the mistake,
What if len(t) = 2 and len(l) = 1?
not possible, t >= l
https://www.codechef.com/viewsolution/30842723
len(t) == len(l) == 2
consider all the case, your code were not considering the all the cases
it will never happen as l is for maximum and t is for minimum
This is my code, I am getting the wrong answer in this but when I ran @ajaymalik code and compared the output they are same. I think I am missing a testcase can you help me.
I know this is an inappropriate way to code but can you help!!
t=int(input())
for z in range(t):
n,m=input().split()
n=int(n)
m=int(m)
sum=n+m
L=[0]*2
M=[0]*2
L[0]=n//10
L[1]=n%10
M[0]=m//10
M[1]=m%10
if(L[0]==0 and M[0]==0):
print(sum)
if(L[0]==0 and M[0]!=0):
if(L[1] > M[0]):
temp=L[1]
L[1]=M[0]
M[0]=temp
sum2=L[1]+(10*M[0]+M[1])
print(max(sum,sum2))
if(M[0]==0 and L[0]!=0):
if(M[1] > L[0]):
temp=M[1]
M[1]=L[0]
L[0]=temp
sum2=M[1]+(10*L[0]+L[1])
print(max(sum,sum2))
if(L[0]!=0 and M[0]!=0):
L.sort()
M.sort()
if(L[-1]<M[-1]):
temp=L[0]
L[0]=M[-1]
M[-1]=temp
num1=10*L[0]+L[1]
num2=10*M[0]+M[1]
sum2=num1+num2
print(max(sum,sum2))
else:
temp=M[0]
M[0]=L[-1]
L[-1]=temp
num1=10*L[0]+L[1]
num2=10*M[0]+M[1]
sum2=num1+num2
print(max(sum,sum2))
Thank you sir
i got it i am missing the test case second digit of min > first digit of max
L.sort()
M.sort()
this the error i guess
thanks, I will check
Try
1
17 23
Your output 58
Expected output 85
And please save your code on an online ide and then share it, don’t copy the whole code here.