Advertisement
bl00dt3ars

problem 1

Feb 27th, 2021
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. exp_needed = float(input())
  2. battles = int(input())
  3.  
  4. exp_collected = 0
  5. battles_counter = 0
  6.  
  7. for i in range(1, battles + 1):
  8.     exp_earned_per_battle = float(input())
  9.     battles_counter += 1
  10.     exp_earned_for_current_battle = exp_earned_per_battle
  11.     if i % 3 == 0:
  12.         exp_earned_for_current_battle *= 1.15
  13.     if i % 5 == 0:
  14.         exp_earned_for_current_battle *= 0.9
  15.     if i % 15 == 0:
  16.         exp_earned_for_current_battle *= 1.05
  17.     exp_collected += exp_earned_for_current_battle
  18.     if exp_collected >= exp_needed:
  19.         print(f"Player successfully collected his needed experience for {battles_counter} battles.")
  20.         break
  21.  
  22. if exp_collected < exp_needed:
  23.     print(f"Player was not able to collect the needed experience, {exp_needed - exp_collected:.2f} more needed.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement