Advertisement
Maxim_01

Untitled

Oct 23rd, 2022
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. needed_xp = int(input())
  2. count_battles = int(input())
  3. total_xp = 0
  4. battles = 0
  5. succeeded = False
  6.  
  7. for battle in range(1, count_battles + 1):
  8.     current_xp = int(input())
  9.     battles += 1
  10.  
  11.     if battle % 3 == 0 and battle % 5 == 0:
  12.         current_xp *= 1.05
  13.  
  14.     elif battle % 3 == 0:
  15.         current_xp *= 1.15
  16.  
  17.     elif battle % 5 == 0:
  18.         current_xp *= 0.90
  19.  
  20.     total_xp += current_xp
  21.  
  22.     if total_xp >= needed_xp:
  23.         succeeded = True
  24.         break
  25.  
  26.  
  27. if succeeded:
  28.     print(f"Player successfully collected his needed experience in {battles} battles.")
  29.  
  30. else:
  31.     diff = needed_xp - total_xp
  32.  
  33.     print(f"Player was not able to collect the needed experience, {float(diff):.2f} more needed. ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement