Advertisement
Angel_Kalinkov

PBE-17September2017-ThreeBrothers_AngelKalinkov

Feb 14th, 2018
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System;
  2.  
  3. class ThreeBrothers
  4. {
  5.     static void Main(string[] args)
  6.     {
  7.         double brother1 = double.Parse(Console.ReadLine());
  8.         double brother2 = double.Parse(Console.ReadLine());
  9.         double brother3 = double.Parse(Console.ReadLine());
  10.         double fishtime = double.Parse(Console.ReadLine());
  11.  
  12.         double cleaningTime = 1 / (1 / brother1 + 1 / brother2 + 1 / brother3);
  13.         double totalTime = cleaningTime + cleaningTime * 0.15;
  14.         double timeDifference = Math.Abs(fishtime - totalTime);
  15.         string output = "";
  16.  
  17.         if (fishtime > totalTime)
  18.         {
  19.             output = string.Format("Yes, there is a surprise - time left -> {0:F0} hours.", Math.Floor(timeDifference));
  20.         }
  21.         else
  22.         {
  23.             output = string.Format("No, there isn't a surprise - shortage of time -> {0:F0} hours.", Math.Ceiling(timeDifference));
  24.         }
  25.  
  26.         Console.WriteLine($"Cleaning time: {totalTime:F}");
  27.         Console.WriteLine(output);
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement