ktopchiev

Three Brothers

Nov 2nd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.35 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 firstBrotherTime = double.Parse(Console.ReadLine());
  14.             var secondBrotherTime = double.Parse(Console.ReadLine());
  15.             var thirdBrotherTime = double.Parse(Console.ReadLine());
  16.             var fatherOnFishing = double.Parse(Console.ReadLine());
  17.             var allBrothersTimeSum = 1 / ((1 / firstBrotherTime) + (1 / secondBrotherTime) + (1 / thirdBrotherTime));
  18.             var timeWithBreak = allBrothersTimeSum + (allBrothersTimeSum * 0.15);
  19.             var timeLeft = fatherOnFishing - timeWithBreak;
  20.             if (timeLeft > 0 && timeLeft < 100)
  21.             {
  22.                 Console.WriteLine(string.Format("Cleaning time: " + (Math.Round(timeWithBreak, 2))));
  23.                 Console.WriteLine(string.Format("Yes, there is a surprise - time left -> " + timeLeft + "hours"));
  24.             }
  25.             else
  26.             {
  27.                 Console.WriteLine(string.Format("Cleaning time: " + (Math.Round(timeWithBreak, 2))));
  28.                 Console.WriteLine(string.Format("No, there isn't a surprise - shortage of time - > " + (Math.Ceiling(timeLeft)) + "hours"));
  29.             }
  30.         }
  31.     }
  32. }
Add Comment
Please, Sign In to add comment