Advertisement
GabrielDas

Untitled

Feb 28th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. using System;
  2.  
  3. namespace P01PartyProfit
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int companionsCount = int.Parse(Console.ReadLine());
  10. int days = int.Parse(Console.ReadLine());
  11. int tempCount = companionsCount;
  12. double coinsPerCompanion = 0;
  13.  
  14. int coins = 0;
  15.  
  16. for(int i = 1; i <= days; i++)
  17. {
  18. coins += 50;
  19. coins -= 2 * companionsCount;
  20.  
  21. if (i % 10 == 0)
  22. {
  23. companionsCount -= 2;
  24.  
  25. }
  26.  
  27. if (companionsCount <= 0)
  28. {
  29. break;
  30. }
  31.  
  32. if (i % 15 == 0)
  33. {
  34. companionsCount += 5;
  35. }
  36.  
  37. if (i % 3 == 0)
  38. {
  39. coins -= 3 * companionsCount;
  40. }
  41.  
  42. if (i % 5 == 0)
  43. {
  44. coins += 20 * companionsCount;
  45.  
  46. }
  47.  
  48. if(i%3==0 && i % 5 == 0)
  49. {
  50. coins -= 2 * companionsCount;
  51. }
  52.  
  53.  
  54. }
  55.  
  56. if (companionsCount <= 0)
  57. {
  58. coinsPerCompanion = Math.Round((double)(coins / tempCount));
  59. Console.WriteLine($"{tempCount} companions received {coinsPerCompanion} coins each.");
  60. }
  61. else
  62. {
  63. coinsPerCompanion = Math.Round((double)(coins / companionsCount));
  64. Console.WriteLine($"{companionsCount} companions received {coinsPerCompanion} coins each.");
  65. }
  66.  
  67. // Console.WriteLine($"{companionsCount} companions received {coinsPerCompanion} coins each.");
  68.  
  69. }
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement