Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Globalization;
- using System.Threading;
- public class Electricity
- {
- public static void Main()
- {
- Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
- checked
- {
- int floors = int.Parse(Console.ReadLine());
- int flats = int.Parse(Console.ReadLine());
- string givenTime = Console.ReadLine();
- string hourStr = givenTime.Remove(givenTime.IndexOf(':'));
- int givenHour = int.Parse(hourStr);
- int totalFlats = floors * flats;
- double powerLamp = 100.53;
- double powerComputer = 125.90;
- double totalPower = 0;
- if (givenHour >= 14 && givenHour <= 18)
- {
- totalPower = totalFlats * ((2 * powerLamp) + (2 * powerComputer));
- }
- else if (givenHour >= 19 && givenHour <= 23)
- {
- totalPower = totalFlats * ((7 * powerLamp) + (6 * powerComputer));
- }
- else if (givenHour >= 0 && givenHour <= 8)
- {
- totalPower = totalFlats * (powerLamp + (8 * powerComputer));
- }
- else if (givenHour >= 9 && givenHour <= 13)
- {
- totalPower = 0;
- }
- Console.WriteLine("{0} Watts", (int)totalPower);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement