Advertisement
Guest User

Untitled

a guest
Nov 17th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Three_Brothers
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double brother1 = double.Parse(Console.ReadLine());
  10. double brother2 = double.Parse(Console.ReadLine());
  11. double brother3 = double.Parse(Console.ReadLine());
  12. double timeAvail = double.Parse(Console.ReadLine());
  13.  
  14. double totalTime = 1 / (1 / brother1 + 1 / brother2 + 1 / brother3);
  15. totalTime += totalTime * 0.15;
  16. Console.WriteLine($"Cleaning time: {totalTime:f2}");
  17.  
  18. double timeLeft = timeAvail - totalTime;
  19.  
  20. if(timeLeft > 0)
  21. {
  22. Console.WriteLine($"Yes, there is a surprise - time left -> {Math.Floor(timeLeft)} hours.");
  23. }
  24. else
  25. {
  26. double diff = totalTime - timeAvail;
  27. Console.WriteLine($"No, there isn't a surprise - shortage of time -> {Math.Ceiling(diff)} hours.");
  28. }
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement