Guest User

Untitled

a guest
Nov 29th, 2025
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. import sys
  4.  
  5. def Solve(a_in):
  6.     a = list(a_in)  # aantal cadeautjes per huis (kopie)
  7.     s = 0           # stappen gezet
  8.     i = 0           # index van huis
  9.     c = 0           # aantal cadeautjes op hand
  10.     while c > 0 or a[i] > 0:
  11.         if c == 0:
  12.             # Pak cadeautjes op
  13.             c = a[i]
  14.             a[i] = 0
  15.         else:
  16.             # Leg cadeautje neer
  17.             c -= 1
  18.             a[i] += 1
  19.         # Stap naar het volgende huis
  20.         s += 1
  21.         i += 1
  22.         if i == len(a):  # einde van de straat
  23.             i = 0
  24.     return s
  25.  
  26. if __name__ == '__main__':
  27.     part1 = [int(x) for x in sys.stdin.readline().split()]
  28.     part2 = [x * 2025 for x in part1]
  29.     print(Solve(part1))
  30.     print(Solve(part2))
Advertisement
Add Comment
Please, Sign In to add comment