fork download
  1. def splt(s):
  2. switch = s[0]
  3. out = switch
  4. for i in xrange(1, len(s)):
  5. if s[i] == switch:
  6. out += s[i]
  7. else:
  8. out += ' '+s[i]
  9. switch = s[i]
  10. return out
  11.  
  12. def main():
  13. n = 20
  14. m = 0
  15. o = '0'
  16. print'0 0'
  17. while m < n:
  18. m += 1
  19. r = splt(o).split()
  20. o = ''
  21. for x in r:
  22. c = bin(len(x))[2:]
  23. v = x[:1]
  24. o += c+v
  25. print`m`,o
  26. print "Done!"
  27.  
  28. if __name__=="__main__":
  29. main()
Success #stdin #stdout 0.01s 7692KB
stdin
Standard input is empty
stdout
0 0
1 10
2 1110
3 11110
4 100110
5 1110010110
6 111100111010110
7 100110011110111010110
8 1110010110010011011110111010110
9 1111001110101100111001011010011011110111010110
10 1001100111101110101100111100111010110111001011010011011110111010110
11 11100101100100110111101110101100100110011110111010110111100111010110111001011010011011110111010110
12 111100111010110011100101101001101111011101011001110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110
13 1001100111101110101100111100111010110111001011010011011110111010110011110011101011001110010110100110111101110101101110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110
14 111001011001001101111011101011001001100111101110101101111001110101101110010110100110111101110101100100110011110111010110011110011101011011100101101001101111011101011011110011101011001110010110100110111101110101101110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110
15 111100111010110011100101101001101111011101011001110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110011100101100100110111101110101100100110011110111010110111100111010110111001011010011011110111010110100110011110111010110011110011101011011100101101001101111011101011011110011101011001110010110100110111101110101101110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110
16 1001100111101110101100111100111010110111001011010011011110111010110011110011101011001110010110100110111101110101101110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110011110011101011001110010110100110111101110101100111001011001001101111011101011010011001111011101011011110011101011011100101101001101111011101011011100101100100110111101110101100100110011110111010110111100111010110111001011010011011110111010110100110011110111010110011110011101011011100101101001101111011101011011110011101011001110010110100110111101110101101110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110
17 1110010110010011011110111010110010011001111011101011011110011101011011100101101001101111011101011001001100111101110101100111100111010110111001011010011011110111010110111100111010110011100101101001101111011101011011100101100100110111101110101101001100111101110101101111001110101101110010110100110111101110101100100110011110111010110011110011101011011100101101001101111011101011001111001110101100111001011010011011110111010110111001011001001101111011101011010011001111011101011011110011101011011100101101001101111011101011011110011101011001110010110100110111101110101100111001011001001101111011101011010011001111011101011011110011101011011100101101001101111011101011011100101100100110111101110101100100110011110111010110111100111010110111001011010011011110111010110100110011110111010110011110011101011011100101101001101111011101011011110011101011001110010110100110111101110101101110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110
18 1111001110101100111001011010011011110111010110011100101100100110111101110101101001100111101110101101111001110101101110010110100110111101110101100111001011001001101111011101011001001100111101110101101111001110101101110010110100110111101110101101001100111101110101100111100111010110111001011010011011110111010110111100111010110011100101101001101111011101011011100101100100110111101110101101001100111101110101101111001110101101110010110100110111101110101100111001011001001101111011101011001001100111101110101101111001110101101110010110100110111101110101100100110011110111010110011110011101011011100101101001101111011101011011110011101011001110010110100110111101110101101110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110100110011110111010110011110011101011011100101101001101111011101011001111001110101100111001011010011011110111010110111001011001001101111011101011010011001111011101011011110011101011011100101101001101111011101011011110011101011001110010110100110111101110101100111001011001001101111011101011010011001111011101011011110011101011011100101101001101111011101011011100101100100110111101110101100100110011110111010110111100111010110111001011010011011110111010110100110011110111010110011110011101011011100101101001101111011101011011110011101011001110010110100110111101110101101110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110
19 10011001111011101011001111001110101101110010110100110111101110101100111100111010110011100101101001101111011101011011100101100100110111101110101101001100111101110101101111001110101101110010110100110111101110101100111100111010110011100101101001101111011101011001110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110111001011001001101111011101011001001100111101110101101111001110101101110010110100110111101110101101001100111101110101100111100111010110111001011010011011110111010110111100111010110011100101101001101111011101011011100101100100110111101110101101001100111101110101101111001110101101110010110100110111101110101100111100111010110011100101101001101111011101011001110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110011100101100100110111101110101100100110011110111010110111100111010110111001011010011011110111010110100110011110111010110011110011101011011100101101001101111011101011011110011101011001110010110100110111101110101101110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110111001011001001101111011101011001001100111101110101101111001110101101110010110100110111101110101100100110011110111010110011110011101011011100101101001101111011101011011110011101011001110010110100110111101110101101110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110100110011110111010110011110011101011011100101101001101111011101011001111001110101100111001011010011011110111010110111001011001001101111011101011010011001111011101011011110011101011011100101101001101111011101011011110011101011001110010110100110111101110101100111001011001001101111011101011010011001111011101011011110011101011011100101101001101111011101011011100101100100110111101110101100100110011110111010110111100111010110111001011010011011110111010110100110011110111010110011110011101011011100101101001101111011101011011110011101011001110010110100110111101110101101110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110
20 111001011001001101111011101011001001100111101110101101111001110101101110010110100110111101110101100100110011110111010110011110011101011011100101101001101111011101011011110011101011001110010110100110111101110101101110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110010011001111011101011001111001110101101110010110100110111101110101100111100111010110011100101101001101111011101011011100101100100110111101110101101001100111101110101101111001110101101110010110100110111101110101101111001110101100111001011010011011110111010110011100101100100110111101110101101001100111101110101101111001110101101110010110100110111101110101101110010110010011011110111010110010011001111011101011011110011101011011100101101001101111011101011010011001111011101011001111001110101101110010110100110111101110101101111001110101100111001011010011011110111010110111001011001001101111011101011010011001111011101011011110011101011011100101101001101111011101011001001100111101110101100111100111010110111001011010011011110111010110011110011101011001110010110100110111101110101101110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110011110011101011001110010110100110111101110101100111001011001001101111011101011010011001111011101011011110011101011011100101101001101111011101011011100101100100110111101110101100100110011110111010110111100111010110111001011010011011110111010110100110011110111010110011110011101011011100101101001101111011101011011110011101011001110010110100110111101110101101110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110111100111010110011100101101001101111011101011001110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110011100101100100110111101110101100100110011110111010110111100111010110111001011010011011110111010110100110011110111010110011110011101011011100101101001101111011101011011110011101011001110010110100110111101110101101110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110111001011001001101111011101011001001100111101110101101111001110101101110010110100110111101110101100100110011110111010110011110011101011011100101101001101111011101011011110011101011001110010110100110111101110101101110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110100110011110111010110011110011101011011100101101001101111011101011001111001110101100111001011010011011110111010110111001011001001101111011101011010011001111011101011011110011101011011100101101001101111011101011011110011101011001110010110100110111101110101100111001011001001101111011101011010011001111011101011011110011101011011100101101001101111011101011011100101100100110111101110101100100110011110111010110111100111010110111001011010011011110111010110100110011110111010110011110011101011011100101101001101111011101011011110011101011001110010110100110111101110101101110010110010011011110111010110100110011110111010110111100111010110111001011010011011110111010110
Done!