SHARE
TWEET

podmnojestva_cikl

nikbel Mar 18th, 2019 (edited) 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. t = open(r'F:\univer\прогнож.txt')
  2. n = int(t.readline())
  3. arr = t.readline().split()
  4. t.close()
  5.  
  6. for i in range(n):
  7.     arr[i] = int(arr[i])
  8. string = ""
  9.  
  10. for i in range(pow(2,n)):
  11.     string = ""
  12.  
  13.     for j in range(n):
  14.         if (i & (1 << j)):
  15.             string += str(arr[j])
  16.     if string == "":
  17.         print('{}')
  18.     else:
  19.         print('{', end = '')
  20.         print(string, end = '')
  21.         print('}')
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top