backlog

Untitled

May 1st, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. while True:
  2.  
  3.     inp=int(input())
  4.     if (inp== 0):
  5.         break
  6.     a=[]
  7.     for i in range(0,inp):
  8.     #print 2**i
  9.         a.append(2**i)
  10.        
  11.        
  12.     p=len(str(inp))
  13.    
  14.     for i in range(inp):
  15.         stp=''
  16.         for r in range(p):
  17.             stp=stp+" "
  18.             c=stp
  19.         for j in range(inp):
  20.            
  21.             if j+i<inp:
  22.                 up=a[j+i]
  23.                 stp=stp+c+str("%d"%up)
  24.                 #print a[j+i],
  25.             else:
  26.                 #print 2*up,
  27.                 stp=stp+c+str("%d"%up)
  28.                 up=2*up
  29.         print stp[1:]
  30.         #print ""
Advertisement
Add Comment
Please, Sign In to add comment