@@ -0,0 +1,1988 @@
+//https://www.hackerrank.com/challenges/random-number-generator%0Aimport java.io.*;%0A%0Apublic class Solution %7B%0A    public static void main(String%5B%5D args) throws IOException %7B%0A        StringBuffer sb = new StringBuffer();%0A        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));%0A        for(short n = Short.parseShort(br.readLine()); n %3E 0; --n)%7B%0A            String%5B%5D input = br.readLine().split(%22 %22);%0A            final short A = Short.parseShort(input%5B0%5D);%0A            final short B = Short.parseShort(input%5B1%5D);%0A            final short C = Short.parseShort(input%5B2%5D);%0A            sb.append(solve(A, B, C).reduce().toString() + %22%5Cn%22);%0A        %7D%0A        System.out.print(sb);%0A    %7D%0A    private static Fraction solve(int a, int b, int c)%7B%0A        Fraction out = new Fraction();%0A        out.den = a * b;%0A        %0A        if (a + b %3C= c)%7B%0A            out.num = out.den;%0A            return out;%0A        %7D%0A        %0A        int minX = 0;%0A        if (b %3C c)%7B%0A            minX = c - b;%0A            out.num = b*minX;%0A        %7D%0A        %0A        int maxX = (a %3C c) ? a : c;%0A        %0A        out.num += c*(maxX - minX);%0A        int temp = maxX*maxX - minX*minX;%0A        if ((temp & 1) == 1)%7B%0A            out.den %3C%3C= 1;%0A            out.num = (out.num %3C%3C 1) - temp;%0A        %7D else %7B%0A            out.num -= temp %3E%3E 1;%0A        %7D%0A        %0A        return out;%0A    %7D%0A    public static class Fraction%7B%0A        public int num;%0A        public int den;%0A        public Fraction()%7B%0A            num = 0;%0A            den = 1;%0A        %7D%0A        public Fraction reduce()%7B%0A            int gcd = GCD(this.num, this.den);%0A            this.num /= gcd;%0A            this.den /= gcd;%0A            return this;%0A        %7D%0A        private static int GCD(int a, int b)%7B%0A            while (b != 0)%7B%0A                int c = b;%0A                b = a %25 b;%0A                a = c;%0A            %7D%0A            return a;%0A        %7D%0A        public String toString()%7B%0A            return num + %22/%22 + den;%0A        %7D%0A    %7D%0A%7D%0A

Create random-number-generator.java