개발문제해결/알고리즘 문제풀이
정올 알고리즘 - 1856 : 숫자사각형2 python3
타진
2020. 6. 28. 16:12
반응형
생각보다 오래걸렸다..
# http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=1129&sca=2010
inputValue = input()
x = int(inputValue.split(' ')[0])
y = int(inputValue.split(' ')[1])
count = 0
for idx in range(1, x+1):
for sub_idx in range(1, y+1):
if idx % 2 == 0:
count -= 1
print(count, end=" ")
else:
count += 1
print(count, end=" ")
if idx % 2 == 1:
count = count + y + 1
else:
count = count + y - 1
print("")
반응형