티스토리 뷰
https://www.acmicpc.net/problem/1193
import sys
X = int(sys.stdin.readline())
count = 1
result = 1
seq = 1
d = 1
if X == 1:
print('1/1')
else:
while(seq < X):
count += 1
seq += count
d *= -1
if(d == -1):
print(count+1-(seq - X + 1), end = '')
print('/', end = '')
print(seq - X + 1)
else:
print(seq - X + 1, end = '')
print('/', end = '')
print(count+1-(seq - X + 1))
'Algorithm > Baekjoon' 카테고리의 다른 글
[백준] 2839 : 설탕 배달 - Python (0) | 2020.04.07 |
---|---|
[백준] 11729 : 하노이 탑 이동 순서 - Python (0) | 2020.04.07 |
[백준] 2292 : 벌집 - Python (0) | 2020.04.06 |
[백준] 1764 : 듣보잡 - Python (0) | 2020.03.27 |
[백준] 13458 : 시험 감독 - Python (0) | 2020.03.27 |