COCI '07 Contest 6 #3 Granica

View as PDF

Submit solution


Points: 10 (partial)
Time limit: 0.6s
Memory limit: 32M

Problem type

Luka started driving international routes with his truck. His biggest problem is the border with Slovenia. The border is a point of entrance into the European Union, so every truck is thoroughly examined. Because of this, Luka always has to wait several hours there. To kill the time, he comes up with various logic and math games.

In one of them, Luka first reads the numbers off of N license plates and writes them down on a piece of paper. Then he tries to find an integer M greater than 1 such that all integers on the paper give the same remainder when divided by M. Luka tries to find as many such integers M as possible. Write a program that, given Luka's N integers, determines all such integers M.

Input Specification

The first line contains the integer N (2 \le N \le 100), the number of integers on paper.

Each of the following N lines contains one integer between 1 and 1\,000\,000\,000 (one billion). All these integers will be distinct.

The input data will guarantee that at least one integer M will always exist.

Output Specification

Output all integers M separated by spaces, in any order.

Scoring

In test cases worth 60\% points, each of the N numbers will be at most 10\,000.

Sample Input 1

3
6
34
38

Sample Output 1

2 4

Sample Input 2

5
5
17
23
14
83

Sample Output 2

3

In the first example, all integers give a remainder of 0 when divided by 2 and the remainder 2 when divided by 4.


Comments


  • -1
    A_H_Ghaznavi  commented on June 4, 2019, 1:21 p.m.

    Please check the judge of this problem.


    • 7
      Ninjaclasher  commented on June 4, 2019, 2:43 p.m.

      For this problem, you must not have any trailing spaces in your output and each line must terminate with a newline (\n).


      • 2
        A_H_Ghaznavi  commented on June 5, 2019, 7:03 a.m.

        Thanks for help!