Hackerrank Library Fine Solution

This is the solution is in python to the problem found in the warmup section in algorithm domain, in Hackerrank.

Screenshot



The Code:
import sys
x=raw_input()
y=raw_input()
x=x.split()
y=y.split()
if(int(x[2])>=int(y[2])):
    if(int(x[2])==int(y[2]) and int(x[1])<int(y[1])):
        print '0'
        raise SystemExit
    if(int(x[1])==int(y[1]) and int(x[0])<int(y[0])):
        print '0'
        raise SystemExit
    if(int(x[2])-int(y[2])!=0):
        print 10000
    elif(int(x[1])-int(y[1])!=0):
        print 500*(int(x[1])-int(y[1]))
    elif(int(x[0])-int(y[0])!=0):
        print 15*(int(x[0])-int(y[0]))
    else:
        print '0'
else:
    print '0'
     

Got any suggestions, drop them here !

Comments

Popular posts from this blog

Non Restoring Division Algorithm Implementation in C

Bit Stuffing Code Implementation in Java

Hackerrank Modified Kaprekar Numbers Solution