rahuls-logo

Rahul has set upon the quest for a new logo of his company. He has created the following continuous logo:

    /\
   /  \
  / /\ \
 / /  \ \
/ / /\ \ \
  \ \ \/ / /
   \ \  / /
    \ \/ /
     \  /
      \/

However, his sister, Rashi, likes the following discontinuous design more

   /\
  /  \
 / /\ \
/ /  \ \
  \ \  / /
   \ \/ /
    \  /
     \/

The size of a logo is the longest continuous streak of same characters on an arm.

So, size of 1st logo is 5 while that of 2nd one is 4.

Now, he wants to paint both of these logos on a canvas. 

Given an integer N, write a program that outputs these logos for sizes N and N + 1, one below the other.

Please note that Rahul's logo is only valid for odd sizes and Rashi's logo is only valid for even values.

Input Format:

Each file has just one line containing integer N.

Output Format:

Output the two logos, one below the other.

Constraints:

N ≤ 100

Notes:

An exact checker is used, so please make sure that you strictly adhere to the output format and leave no trailing spaces.

SAMPLE INPUT
3

SAMPLE OUTPUT
  /\
 /  \
/ /\ \
  \ \/ /
   \  /
    \/
   /\
  /  \
 / /\ \
/ /  \ \
  \ \  / /
   \ \/ /
    \  /
     \/

Source: hackerearth | Difficulty: EASY
Tags: Fundamentals

Implementation


Solutions:
import sys
def rashi(n):
	for i in range(n):
		for j in range(2*n):
			if((i+j)%2==1 and i+j>=n-1 and j<=n-1):
				sys.stdout.write('/')
			elif((j-i)%2==0 and j>=n):
				sys.stdout.write('\\')
			else:
				sys.stdout.write(' ')
			if j-i==n+1:
				break
		print()
 
 
	for i in range(n):
		sys.stdout.write('  ')
		for j in range(2*n):
			if((j+i)%2==0 and j<=n-1 and i<=j):
				sys.stdout.write('\\')
			elif((j-i)%2==1 and j>=n):
				sys.stdout.write('/')
			
			else:
				sys.stdout.write(' ')
			if j+i==2*n:
				break
		print()
def rahul(n):
	for i in range(n):
		for j in range(2*n):
			if(j<n and (i+j)%2==0 and i+j>=n-1):
				sys.stdout.write('/')
			elif(j>=n and (j+i)%2==1):
				sys.stdout.write('\\')
			else:
				sys.stdout.write(' ')
			if j-i==n:
				break
		print()
	for i in range(n):
		sys.stdout.write('  ')
		for j in range(2*n):
			if(j<n and (j-i)%2==0 and j>=i):
				sys.stdout.write('\\')
			elif(j>=n and (j-i)%2==1):
				sys.stdout.write('/')
			else:
				sys.stdout.write(' ')
			if i+j==2*n-1:
				break
		print()       
def main():
	x=eval(input())
	if x%2==0:
		rashi(x)
		rahul(x+1)
	else:
		rahul(x)
		rashi(x+1)
main()


##  \ \ \/ / /
##   \ \  / /
##    \ \/ /
##     \  /
##      \/
###n odd
#n=7
n=int(eval(input()))
def fore(n):
	for i in range(n):
		if i % 2 == 0:
			strx = ((n-1-i)*" " + "/ "*(i//2) + "/\\" + (i//2) * " \\")
			print(strx)
		else:
			print((" " * (n-1-i) + (i//2+1)*'/ ' + (i//2+1) * ' \\'))
def bg(n):
	for i in range(n-1, -1, -1):
		if i % 2 == 0:
			strx = ((n-1-i+1+1)*" " + "\\ "*(i//2) + "\\/" + (i//2) * " /")
			print(strx)
		else:
			print((" " * (n-1+1-i+1) + (i//2+1)*'\\ ' + (i//2+1) * ' /'))
fore(n)
bg(n)
fore(n+1)
bg(n+1)


n=eval(input())
def kanu(n):
	for i in range(n):
		ans=""
		j=0
		while i+j!=n-1:
			ans+=" "
			j+=1
		while j!=n:
			ans+="/"
			j+=1
			if j==n:
				break
			ans+=" "
			j+=1
		j=n-1
		while i+j>n-2:
			if ans[j]=="/":
				ans+="\\"
				j-=1
				if i+j<=n-2:
					break
				else:
					ans+=" "
					j-=1
			else:
				ans+=" "
				j-=1
				if i+j<=n-2:
					break
				else:
					ans+="\\"
					j-=1
		print(ans)
	for i in range(n-1,-1,-1):
		ans=""
		j=0
		while i+j!=n+1:
			ans+=" "
			j+=1
		while j!=n+2:
			ans+="\\"
			j+=1
			if j==n+2:
				break
			ans+=" "
			j+=1
		j=n+1
		while i+j>n:
			if ans[j]=="\\":
				ans+="/"
				j-=1
				if i+j<=n:
					break
				else:
					ans+=" "
					j-=1
			else:
				ans+=" "
				j-=1
				if i+j<=n:
					break
				else:
					ans+="/"
					j-=1
		print(ans)
kanu(n)
kanu(n+1)
#2x*(2x+4)+x*x or