bingxuan9112

BAMBOOFOX tree

Dec 31st, 2019
508
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. from os import chdir
  2. from glob import glob
  3.  
  4. def dfs(s):
  5.     s = s[0]
  6.     #print('s = ', s)
  7.     typ = s[-1]
  8.     #print(typ)
  9.     if typ == '+':
  10.         return dfs(glob(s+"/0_*")) + dfs(glob(s+"/1_*"))
  11.     if typ == 'x':
  12.         return dfs(glob(s+"/0_*")) * dfs(glob(s+"/1_*"))
  13.     if typ == 'r':
  14.         #print('path = ', s)
  15.         return int(open(s).read())
  16. for i in range(37):
  17.     chdir("flag["+str(i)+"]/")
  18.     print(chr(dfs(glob("0_*"))), end = '')
  19.     chdir("..")
Advertisement
Add Comment
Please, Sign In to add comment