DIVREL - Divisibility Relation
English | Vietnamese |
Given n positive integers. Your task is to select a maximum number of integers so that there are no two numbers a, b in which a is divisible by b.
Input
- Line 1: n (1 ≤ n ≤ 200).
- Line 2: n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109).
Output
- Line 1: k, the maximum number of integers that can be selected.
- Line 2: k selected integers.
Example
Input 8 1 2 3 5 6 8 7 9 Output 5 5 6 8 7 9
Input 4 2 3 2 3 Output 2 2 3
Added by: | Jimmy |
Date: | 2008-10-22 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 VB.NET |
Resource: | Vietnamese IOI Selection Test 2007 |