Advertisement
deforse

Three brothers

Sep 19th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Three_brothers
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double timeA = double.Parse(Console.ReadLine());
  14.             double timeB = double.Parse(Console.ReadLine());
  15.             double timeC = double.Parse(Console.ReadLine());
  16.             double timeD = double.Parse(Console.ReadLine());
  17.  
  18.             double workTime = ((1 / ((1 / timeA) + (1 / timeB) + (1 / timeC))) * 1.15);
  19.             double timeLeft = timeD-workTime;
  20.  
  21.             if (timeLeft > 0)
  22.             {
  23.                 Console.WriteLine($"Cleaning time: {workTime:f2}");
  24.                 timeLeft = Math.Floor(timeD-workTime);
  25.                 Console.WriteLine($"Yes, there is a surprise - time left -> {timeLeft} hours.");
  26.             }
  27.             else
  28.             {
  29.                 Console.WriteLine($"Cleaning time: {workTime:f2}");
  30.                 double timeLeft1 = Math.Ceiling(Math.Abs(timeD-workTime));
  31.                 Console.WriteLine($"No, there isn't a surprise - shortage of time -> {timeLeft1} hours.");
  32.             }
  33.  
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement