Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

3 anos atrás
123456789101112131415161718192021
  1. import re
  2. text = open(0).read()
  3. x1, x2, y1, y2 = [int(n) for n in re.findall(r'-?\d+', text)]
  4. peaks = []
  5. for vyi in range(-100, 100):
  6. for vxi in range(0, 400):
  7. x, y, vx, vy = 0, 0, vxi, vyi
  8. for _ in range(200):
  9. x += vx
  10. y += vy
  11. vx -= vx // abs(vx) if vx else 0
  12. vy -= 1
  13. if x1 <= x <= x2 and y1 <= y <= y2:
  14. peaks.append(vyi * (vyi + 1) // 2)
  15. break
  16. if x > x2:
  17. break
  18. print(max(peaks))
  19. print(len(peaks))