# UTS Programming Competition 2014 Problem 4

### From ProgSoc Wiki

Revision as of 23:17, 15 March 2014 by Tomchristmas (Talk | contribs)

# Problem 4: Greatest Common Divisor

*Run time limit: 10 seconds*

## Problem Description

The greatest common divisor, or GCD, of two or more integers is the largest positive integer that divides the numbers without a remainder. For example, the GCD of 8 and 12 is 4.

Your task is to find, in a list of integers, the two largest numbers that yield the largest GCD.

## Data Specification

### Input

Multiple lines of input with multiple integers on each line, separated by spaces. Each number shall greater than 1 and less than 1,000,000. There shall be up to 100 numbers on each line. Each line shall be terminated with a zero (0).

The final line of input shall be marked with a solitary zero (0).

### Output

For each line of input, output the two largest numbers that yield the largest GCD, and their GCD.

### Sample Input

4 8 24 0 7 11 2 13 23 0 48 64 24 72 0 0

### Sample Output

8 24 8 13 23 1 48 72 24

## Solutions

Put your solutions here!