bacco

Трима братя; Three brothers

Feb 8th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.12 KB | None | 0 0
  1. using System;
  2.  
  3. namespace tESt
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             var brother_1 = double.Parse(Console.ReadLine());      // 3
  10.             var brother_2 = double.Parse(Console.ReadLine());      // 4
  11.             var brother_3 = double.Parse(Console.ReadLine());      // 5
  12.             var fatherFishing = double.Parse(Console.ReadLine());  // 3.6
  13.  
  14.             var cleaningTime = 1 / ((1 / brother_1) + (1 / brother_2) + (1 / brother_3)) * 1.15;  // 15%
  15.  
  16.             var leftHours = fatherFishing - cleaningTime;
  17.             Console.WriteLine($"Cleaning time: {cleaningTime:f2}");
  18.  
  19.             if (leftHours >= 0)
  20.             {
  21.                 leftHours = Math.Floor(leftHours);
  22.                 Console.WriteLine($"Yes, there is a surprise - time left -> {leftHours} hours.");
  23.             }
  24.             else
  25.             {
  26.                 leftHours = Math.Abs(leftHours);
  27.                 leftHours = Math.Ceiling(leftHours);
  28.                 Console.WriteLine($"No, there isn't a surprise - shortage of time -> {leftHours} hours.");
  29.             }
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment