Fractional Sequence
시간 제한: 1000ms메모리 제한: 2048MB출처: ICPC ECNA 2025-2026BOJ 35378
문제
Consider the following increasing sequence, , of rational numbers: \[ 1, 2, 2\frac{1}{2}, 3, 3\frac{1}{3}, 3\frac{2}{3} , 4, 4\frac{1}{4}, 4\frac{1}{2}, 4\frac{3}{4}, 5, 5\frac{1}{5}, 5\frac{2}{5}, 5\frac{3}{5}, 5\frac{4}{5}, 6, \ldots . \] is composed of an infinite set of blocks, , where block is \[ i, i+1/i, i+2/i, \ldots, i+(i-1)/i . \] So , etc. Write a program which takes as input an integer and outputs .
입력
Input is a single line containing an integer, ().
출력
Output as a single integer if the answer is a whole number. Otherwise, output the integer part, a single space and a proper fraction in lowest terms (i.e. and ). See the sample outputs.
예제
예제 1
입력
326
출력
26
예제 2
입력
448
출력
30 2/5
예제 3
입력
4000000000
출력
89443 19596/89443
코드를 제출하려면 로그인하세요.