SHARE
TWEET

Untitled

a guest Nov 19th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def lovushka(s, m, n):
  2.     if m != 0:
  3.         s = s + '0'
  4.         lovushka(s, m - 1, n)
  5.         s = s[:-1:]
  6.     if n != 0:
  7.         s = s + '1'
  8.         lovushka(s, m, n - 1)
  9.         s = s[:-1]
  10.     if m + n == 0:
  11.         ans.append(s)
  12.  
  13.  
  14. m, n = map(int, input().split())
  15. ans = []
  16. lovushka("", m, n)
  17. print(ans)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top