grach

2017_September_17 Three Brothers

Feb 27th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.11 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.             var firstBrother = double.Parse(Console.ReadLine());
  14.             var secondBrother = double.Parse(Console.ReadLine());
  15.             var thirdBrother = double.Parse(Console.ReadLine());
  16.             var fishingTime = double.Parse(Console.ReadLine());
  17.  
  18.             double totalTime = 1 / (1 / firstBrother + 1 / secondBrother + 1 / thirdBrother);
  19.             totalTime += totalTime*0.15;
  20.  
  21.             Console.WriteLine($"Cleaning time: {totalTime:f2}");
  22.  
  23.             if (totalTime >= fishingTime)
  24.             {
  25.                 Console.WriteLine($"No, there isn't a surprise - shortage of time -> {Math.Floor(fishingTime-totalTime)*-1} hours.");
  26.             }
  27.             else
  28.             {
  29.                 Console.WriteLine($"Yes, there is a surprise - time left -> {Math.Ceiling(totalTime-fishingTime)*-1} hours.");
  30.             }                
  31.  
  32.            
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment