Krasimir_Slavov

Untitled

Sep 22nd, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 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 _3Brothers
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double A = double.Parse(Console.ReadLine());
  14. double B = double.Parse(Console.ReadLine());
  15. double C = double.Parse(Console.ReadLine());
  16. double D = double.Parse(Console.ReadLine());
  17.  
  18. double totalTime = 1 / (1 / A + 1 / B + 1 / C);
  19.  
  20. double totalTimeWithRest = totalTime * 0.15 + totalTime;
  21.  
  22. double leftTime = D - totalTimeWithRest;
  23.  
  24. Console.WriteLine($"Cleaning time: {totalTimeWithRest:F2}");
  25.  
  26. if (leftTime > 0)
  27. {
  28. Console.WriteLine($"Yes, there is a surprise - time left -> {Math.Floor(leftTime)} hours.");
  29. }
  30. else
  31. {
  32. leftTime = Math.Abs(leftTime);
  33. Console.WriteLine($"No, there isn't a surprise - shortage of time -> {Math.Ceiling(leftTime)} hours.");
  34. }
  35.  
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment