[백준] 1193 : 분수찾기 - Python
https://www.acmicpc.net/problem/1193 1193번: 분수찾기 첫째 줄에 X(1 ≤ X ≤ 10,000,000)가 주어진다. www.acmicpc.net 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 = ..
Algorithm/Baekjoon
2020. 4. 6. 22:49