pastebin

Paste Search Dynamic
Recent pastes
deque
  1. from collections import deque
  2. def dfs(cnt,  t, ans = deque()):
  3.     global check
  4.     if cnt == 7:
  5.         if sum(ans) == 100:
  6.             print(*ans, sep="n")
  7.             check = true
  8.         return  
  9.     for i in range(t, 9):
  10.         if check:
  11.             break
  12.         ans.append(arr[i])
  13.         dfs(cnt+1, i+1, ans)
  14.         ans.pop()
  15. arr = []
  16. check = false
  17. for _ in range(9):
  18.     arr.append(int(input()))
  19.  
  20. dfs(0,  0)
Parsed in 0.007 seconds