Menu

Hackerearth – Micro and his Son

January 27, 2017 - Hackerearth

Language: Python

def ch(s):
    s=str(s)
    st=(4-len(s))*"0"+s
    return st==st[::-1]
 
def incr(ans,s):
    ans=ans+ch(s)
    if s%100==59:
        s=(s/100+1)*100
    else: s=s+1
    return ans,s
 
t=int(raw_input())
while(t):
    t=t-1
    l,r=map(int,raw_input().split())
    ans=0
    num=l
    while(num<=r):
        ans,num=incr(ans,num)
    print ans

(215)

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on VK

Author of this post : UnknownA AuthorA

Leave a Reply

Your email address will not be published. Required fields are marked *