[BOJ][Python][브2][1193] 분수찾기
문제 링크
첫 번째 풀이
정답코드
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import sys
from math import sqrt
from bisect import bisect_left, bisect_right
# sys.stdin = open("input.txt", "r")
n = int(input())
level = 0
while level * (level + 1) / 2 < n:
level += 1
level -= 1
rest = n - level * (level + 1) / 2 - 1
if level % 2 == 0:
x, y = level + 1 - rest, 1 + rest
else:
x, y, = 1 + rest, level + 1 - rest
print('%d/%d' % (x, y))
Success Notice: 수고하셨습니다.
Leave a comment