We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Implementation
- Library Fine
- Discussions
Library Fine
Library Fine
Sort by
recency
|
995 Discussions
|
Please Login in order to post a comment
my c# solution
return y1 > y2 ? 10000 : y1 < y2 ? 0 : m1 > m2 ? (m1 - m2) * 500 : m1 < m2 ? 0 : (d1 > d2) ? (d1 - d2) * 15 : 0;
JavaScript
i don't understand why it doesn't work this way
but works this way
c#
public static int libraryFine(int d1, int m1, int y1, int d2, int m2, int y2)
def libraryFine(d1, m1, y1, d2, m2, y2): fine = 0 if d1d2 and m1==m2 and y1==y2: fine = 15 * (d1-d2) elif m1>m2 and y1==y2: fine = 500 * (m1-m2) elif y1!=y2 and y1>y2: fine = 10000
python3