@@ -0,0 +1,1378 @@
+%0A/*ID: moser.el%0ALANG: JAVA%0ATASK: frac1%0A */%0A%0Aimport java.io.*;%0Aimport java.util.*;%0A%0Aclass Fraction implements Comparable%3CFraction%3E %7B%0A    private int numerator;%0A    private int denominator;%0A%0A    Fraction(int numerator, int denominator) %7B%0A        this.numerator = numerator;%0A        this.denominator = denominator;%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        return numerator + %22/%22 + denominator;%0A    %7D%0A%0A    @Override%0A    public int compareTo(Fraction fraction) %7B%0A        // Consider a/b and c/d:%0A        // a/b -%3E ad/bd%0A        // c/d -%3E cb/bd%0A        Integer ad = this.numerator * fraction.denominator;%0A        Integer cb = fraction.numerator * fraction.denominator;%0A        return ad.compareTo(cb);%0A    %7D%0A%7D%0A%0Aclass frac1 %7B%0A    public static void main(String%5B%5D args) throws IOException %7B%0A        BufferedReader f = new BufferedReader(new FileReader(%22frac1.in%22));%0A        PrintWriter out = new PrintWriter(new FileWriter(%22frac1.out%22));%0A%0A        int N = Integer.parseInt(f.readLine());%0A        List%3CFraction%3E fractions = new ArrayList%3CFraction%3E();%0A        fractions.add(new Fraction(0, 1));%0A        fractions.add(new Fraction(1, 1));%0A%0A        int%5B%5D primes = new int%5BN%5D;%0A%0A        %0A        %0A        Collections.sort(fractions);%0A        for (Fraction fraction : fractions) %7B%0A            out.println(fraction);%0A        %7D%0A%0A        f.close();%0A        out.close();%0A    %7D%0A%7D%0A

put in place the infrastructure to build the solution