Advertisement
SimeonTs

SUPyF2 P.-Mid-Exam/4 November 2018 - 01. Party Profit

Oct 31st, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.99 KB | None | 0 0
  1. """
  2. Technology Fundamentals Mid Exam - 4 November 2018
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1316#0
  4.  
  5. SUPyF2 P.-Mid-Exam/4 November 2018 - 01. Party Profit
  6.  
  7. Problem:
  8. As a young adventurer, you travel with your party around the world, seeking for gold and glory.
  9. But you need to split the profit among your companions.
  10. You will receive a party size. After that you receive the days of the adventure.
  11. Every day, you are earning 50 coins, but you also spent 2 coin per companion for food.
  12. Every 3rd (third) day, you have a motivational party, spending 3 coins per companion for drinking water.
  13. Every 5th (fifth) day you slay a boss monster and you gain 20 coins per companion.
  14. But if you have a motivational party the same day, you spent additional 2 coins per companion.
  15. Every 10th (tenth) day at the start of the day, 2 (two) of your companions leave,
  16. but every 15th (fifteenth) day 5 (five) new companions are joined at the beginning of the day.
  17. You have to calculate how much coins gets each companion at the end of the adventure.
  18. Input / Constraints
  19. The input will consist of exactly 2 lines:
  20. • party size – integer in range [1…100]
  21. • days – integer in range [1…100]
  22. Output
  23. Print the following message: "{companionsCount} companions received {coins} coins each."
  24. You cannot split a coin, so take the integral part (round down the coins to integer number).
  25. Examples:
  26. Input: Output:
  27. 3      3 companions received 90 coins each.
  28. 5
  29.  
  30. Input: Output:
  31. 15     3 companions received 90 coins each.
  32. 30
  33. """
  34. import math
  35.  
  36. people = int(input())
  37. days = int(input())
  38. coins = 0
  39. for day in range(1, days + 1):
  40.     if day % 10 == 0:
  41.         people -= 2
  42.     if day % 15 == 0:
  43.         people += 5
  44.  
  45.     coins += 50 - (2 * people)
  46.  
  47.     if day % 3 == 0:
  48.         coins -= 3 * people
  49.     if day % 5 == 0:
  50.         coins += 20 * people
  51.         if day % 3 == 0:
  52.             coins -= 2 * people
  53.  
  54. print(f"{people} companions received {math.floor(coins / people)} coins each.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement