Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. using System;
  2.  
  3. public class ThreeBrothers
  4. {
  5. public static void Main()
  6. {
  7. var firstBrTime = double.Parse(Console.ReadLine());
  8. var secondBrTime = double.Parse(Console.ReadLine());
  9. var thirdBrTime = double.Parse(Console.ReadLine());
  10. var fishingTime = double.Parse(Console.ReadLine());
  11.  
  12. var totalTime = 1 / (1 / firstBrTime + 1 / secondBrTime + 1 / thirdBrTime);
  13. var restTime = totalTime * 0.15;
  14. var cleaningTime = totalTime + restTime;
  15. var timeLeft = fishingTime - cleaningTime;
  16.  
  17. Console.WriteLine($"Cleaning time: {cleaningTime:F2}");
  18.  
  19. if (timeLeft > 0)
  20. {
  21. Console.WriteLine($"Yes, there is a surprise - time left -> {Math.Floor(timeLeft)} hours.");
  22. }
  23. else // timeLeft <= 0
  24. {
  25. Console.WriteLine($"No, there isn't a surprise - shortage of time -> {Math.Ceiling(Math.Abs(timeLeft))} hours.");
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement