Ordered Fractions
면접 대비시간 제한1초메모리 제한1024 MB
N이 주어질 때 분모가 N 이하인 0과 1 사이의 기약분수를 모두 세고 오름차순으로 나열한다.
문제
Consider the set of all reduced fractions (rational numbers) between 0 and 1 inclusive with denominators less than or equal to N.
Here is the proper set when N = 5:
0/1 1/5 1/4 1/3 2/5 1/2 3/5 2/3 3/4 4/5 1/1
Write a program that, given an integer N between 1 and 500 inclusive, prints the total number of fractions, orders them, and prints a few of them to prove that your program can order them correctly.
입력
The only line contains one integer, N.
출력
On the first line of the output, print the total number of fractions per the rules above. Subsequent lines should print every fraction from the ordered list, starting with the first fraction.