아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Sum of Remainders

시간 제한2초메모리 제한1024 MB

요약
N이 100 이하일 때 S_K(1)부터 S_K(N)까지의 값이 주어지면, 2 이상의 정수로 이루어진 중복집합 K를 복원한다.
난이도

보통10점 중 7점

유형
수학, 정수론, 완전 탐색
정답자
아직 제출이 없습니다

문제

Given a multiset (elements may be duplicates), K of integers ≥ 2, the sum of remainders function associated with K, SK, defined on non-negative integers, n, is given by:

SK(n) = ∑ (k in K | n mod k)

For instance, if K = {2, 5, 5, 11},

SK(23) = 23 mod 2 + 23 mod 5 + 23 mod 5 + 23 mod 11 = 1 + 3 + 3 + 1 = 8.

Note that SK(0) = 0 for any K.

For this problem you will write a program which takes as input the values of SK(n) for n from 1 to N for some unknown multiset K. The program will output the number of integers in K followed by the integers in K in non-decreasing order.

입력

Input consists of multiple lines. The first line contains a single decimal integer N, (1 ≤ N ≤ 100), which is the number of values of SK(n), (1 ≤ n ≤ N), that follow. The following lines contain the N values as space separated decimal integers, 10 values per line (except perhaps for the last line).

출력

There is one line of output containing a space separated sequence of decimal integers. The first value is the number, m, of integers in the multiset K. This is followed by the m integers of the multiset K in non-decreasing order. Note: if a value is a member multiple times, it should appear in the list that many times.

예제2

  1. 예제 1

    입력
    16
    4 6 10 12 6 8 12 14 18 10
    3 5 9 11 5 7
    
    예상 출력
    4 2 5 5 11
    
  2. 예제 2

    입력
    20
    3 6 6 9 12 6 2 5 5 8
    11 5 8 4 4 7 10 4 7 10
    
    예상 출력
    3 3 6 7