petyaminkova91

Untitled

Oct 27th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. using System;
  2.  
  3. namespace MidExam04._11._18
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int peopleCount = int.Parse(Console.ReadLine());
  10. int days = int.Parse(Console.ReadLine());
  11.  
  12. int currentCoins = 0;
  13.  
  14. for (int i = 1; i <= days; i++)
  15. {
  16. if (i % 10 == 0)
  17. {
  18. peopleCount -= 2;
  19. }
  20.  
  21. if (i % 15 == 0)
  22. {
  23. peopleCount += 5;
  24. }
  25.  
  26. currentCoins += 50;
  27. currentCoins -= 2 * peopleCount;
  28.  
  29. if (i % 3 == 0)
  30. {
  31. currentCoins -= 3 * peopleCount;
  32. }
  33.  
  34. if (i % 5 == 0)
  35. {
  36. currentCoins += 20 * peopleCount;
  37.  
  38. if (i % 3 == 0)
  39. {
  40. currentCoins -= 2 * peopleCount;
  41. }
  42. }
  43. }
  44.  
  45. int coinsPerPerson = currentCoins / peopleCount;
  46.  
  47. Console.WriteLine($"{peopleCount} companions received {coinsPerPerson} coins each.");
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment