Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace DomashnoThreeBrothers
- {
- class Program
- {
- static void Main(string[] args)
- {
- // get times of the three brothers and father gone time
- double TimeNeedToCleanFirstBrother = double.Parse(Console.ReadLine());
- double TimeNeedToCleanSecondBrother = double.Parse(Console.ReadLine());
- double TimeNeedToCleanThirdBrother = double.Parse(Console.ReadLine());
- double TimeGoneFather = double.Parse(Console.ReadLine());
- // define percent of time for relax
- double PercentOfTimeForRelax = 15;
- // calculate cleaning time needed
- double TimeNeedToCleenAllBrothers = 1 / (1 / TimeNeedToCleanFirstBrother + 1 / TimeNeedToCleanSecondBrother + 1 / TimeNeedToCleanThirdBrother);
- double TimeNeedToCleanAllBrothersWithRelax = TimeNeedToCleenAllBrothers + (TimeNeedToCleenAllBrothers * 1.00 * PercentOfTimeForRelax / 100);
- // deside if the time is enough and print result
- Console.WriteLine($"Cleaning time: {TimeNeedToCleanAllBrothersWithRelax:F2}");
- double TimeDifference = TimeGoneFather-TimeNeedToCleanAllBrothersWithRelax;
- if (TimeDifference >= 0)
- {
- double TimeLeft = Math.Floor(TimeDifference);
- Console.WriteLine($"Yes, there is a surprise - time left -> {TimeLeft} hours.");
- }
- else
- {
- double TimeNotEnough = Math.Ceiling(TimeDifference*(-1));
- Console.WriteLine($"No, there isn't a surprise - shortage of time -> {TimeNotEnough} hours.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement