Advertisement
Guest User

Untitled

a guest
May 27th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _19_Thea_The_Photographer
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int allPictures = int.Parse(Console.ReadLine());
  10. int filterTime = int.Parse(Console.ReadLine());
  11. double percentOfTheGoodPhothos = int.Parse(Console.ReadLine());
  12. int neededTimeForFiltering = int.Parse(Console.ReadLine());
  13.  
  14.  
  15. double filteredPictures = Math.Ceiling(allPictures * (percentOfTheGoodPhothos / 100));
  16. int totalTimeForFiltering = (allPictures * filterTime) + (int)(filteredPictures * neededTimeForFiltering);
  17.  
  18. int seconds = totalTimeForFiltering;
  19. int minutes = 0;
  20. int hours = 0;
  21. int days = 0;
  22.  
  23. bool theTimeIsCalculated = true;
  24. while (theTimeIsCalculated)
  25. {
  26. if (minutes > 59)
  27. {
  28. minutes -= 60;
  29. hours++;
  30. }
  31. if (hours > 23)
  32. {
  33. hours -= 24;
  34. days++;
  35. }
  36. if (totalTimeForFiltering > 59)
  37. {
  38. totalTimeForFiltering -= 60;
  39. seconds -= 60;
  40. minutes++;
  41. }
  42. else
  43. {
  44. theTimeIsCalculated = false;
  45. }
  46. }
  47.  
  48.  
  49.  
  50. Console.WriteLine($"{days:D1}:{hours:D2}:{minutes:D2}:{seconds:D2}");
  51. }
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement