본문 바로가기
Study/알고리즘

[백준 알고리즘] 1193번 Python

by Becoming a Hacker 2021. 10. 4.
반응형

문제 정보

 

제출 코드

# https://wlstyql.tistory.com/53 참고
x = int(input())

stage, start_data = 1, 1
while stage+start_data<=x:
	start_data += stage
	stage += 1

# EVEN
if(stage%2==0):
	print(x-start_data+1, end='/')
	print(str(stage-(x-start_data)))
#ODD
else:
	print(str(stage-(x-start_data)), end='/')
	print(x-start_data+1)

댓글