13192 - GEC1506-Ignore multiples and search   

Description

Given a boundary with numbers, several condition numbers, and a target number, you need to

  1. Generate a list of numbers within the given boundary, but without the multiples of condition numbers.
  2. Print out positions that the target numbers are found.

Input

The input consists of 3 lines as 3 parts with the following syntax:

0,20

3,5,7

0,16

  1. The first two are the boundary numbers which indicates the lower bound is 0 and the upper bound is 20.
  2. The second line is the constrained numbers which are 3, 5, and 7.
  3. The last line are the target numbers to search.
  4. All the numbers are integers.

 

With the input, you need to generate a list of integers within the boundary of 0 and 20. (20 is excluded!)

Note that the generated list MUST avoid all the multiples of the constrained numbers which are 3, 5, and 7 (e.x. 0, 3, 5, 6, 7, 9 ... should be avoided as they are the multiples of 3, 5 OR 7)

Output

The outputs are:

  1. The generated list that formated with a "comma" between each element. (Note that the output list of numbers should be in ascending order.)
  2. The position of the target number found from the generated list. e.g. 0 is not found, so print out N/A;  16 is found at the 7th position.

Sample Input  Download

Sample Output  Download

Tags




Discuss