UTS Open '21 P2 - Prime Array

View as PDF

Submit solution

Points: 7
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Edward is learning about prime numbers in math class today. Having just learnt what arrays are the day before, he decided to invent what he now calls a prime array. Specifically, he calls an array prime if the greatest common divisor of all its elements is 1. For example, [4, 5, 2] and [1] are prime but [3, 9, 6] and [7] are not. Having caught him dozing off in class, Mr. Brown challenges Edward to find an array which has exactly K prime non-empty subarrays. Since Mr. Brown is not looking forward to spending more than a few hours reading over the array, he specifies that the array must contain no more than 100 elements, and that all the elements of the array must be integers in the range [1, 10^9]. Now on the spot, Edward is asking you to help him solve this problem. Please help him find an array satisfying Mr. Brown's requirements.

Constraints

For this problem, you MUST pass the sample case in order to receive points.

0 \le K \le 5 \times 10^3

It can be proven that an array satisfying the requirements always exists under the given constraints.

Input Specification

The first and only line of input contains an integer K, as described in the problem statement.

Output Specification

First, output one line containing N (1 \le N \le 100), the length of the array A you have found.

Then output N space separated integers A_i (1 \le A_i \le 10^9), representing the elements of the array A.

Sample Input

6

Sample Output

5
5 8 2 6 3

Explanation

The prime subarrays are: [5, 8], [5, 8, 2], [2, 6, 3], [5, 8, 2, 6], [8, 2, 6, 3], [5, 8, 2, 6, 3].


Comments


  • -20
    d3story  commented on Feb. 8, 2021, 8:22 p.m. edit 4

    This comment is hidden due to too much negative feedback. Click here to view it.


    • -2
      WAO  commented on Feb. 9, 2021, 6:13 p.m.

      As a CMO qualifier myself I can assure you that there is nothing wrong with this problem and it's perfectly fine the way it is


    • -5
      rexn  commented on Feb. 9, 2021, 8:47 a.m. edited

      This comment is hidden due to too much negative feedback. Click here to view it.


    • -15
      kevinyang  commented on Feb. 8, 2021, 11:31 p.m.

      This comment is hidden due to too much negative feedback. Click here to view it.


    • 9
      EpicChadGamer  commented on Feb. 8, 2021, 10:40 p.m. edited

      Just solve the problem lol


    • 9
      csDude256  commented on Feb. 8, 2021, 8:31 p.m.

      Sub arrays of length one are valid as shown in the problem statement:

      For example, [4, 5, 2] and [1] are prime but [3, 9, 6] and [7] are not