Advertisement
Guest User

Untitled

a guest
Jan 15th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. numRecipes = int(input())
  2.  
  3.  
  4. scores = [3, 7]
  5.  
  6. elf1 = 0
  7. elf2 = 1
  8.  
  9. while len(scores) < numRecipes + 10:
  10.  
  11.   elf1 = (elf1 + 1 + scores[elf1]) % len(scores)
  12.   elf2 = (elf2 + 1 + scores[elf2]) % len(scores)
  13.  
  14.   newScores = scores[elf1] + scores[elf2]
  15.  
  16.   if newScores > 9:
  17.     scores.append(1)
  18.     scores.append(newScores % 10)
  19.   else:
  20.     scores.append(newScores)
  21.  
  22.  
  23. print(scores)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement