You are viewing a single comment's thread. Return to all comments →
In C#
using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void Main(String[] args) { var r = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToList(); var e = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToList(); DateTime returned = new DateTime(r[2], r[1], r[0]); DateTime expected = new DateTime(e[2], e[1], e[0]); int fine = 0; if(returned > expected) { if(returned.Year == expected.Year && returned.Month == expected.Month) { fine = 15 * (returned.Day - expected.Day); } else if (returned.Year == expected.Year) { fine = 500 * (returned.Month - expected.Month); } else fine = 10000; } Console.WriteLine(fine); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 26: Nested Logic
You are viewing a single comment's thread. Return to all comments →
In C#