#C13300. Geometric Sequence Checker

    ID: 42824 Type: Default 1000ms 256MiB

Geometric Sequence Checker

Geometric Sequence Checker

Given a sequence of numbers, determine whether it forms a geometric progression. A sequence is said to be geometric if there exists a constant common ratio \(r\) such that for every index \(i \geq 1\), the following holds:

[ a_i = a_{i-1} \times r ]

Note:

  • An empty sequence or a sequence with a single element is considered geometric.
  • If the first element is 0 and the sequence has more than one element, then the sequence is geometric only if all elements are 0.

Your task is to read in a sequence of numbers and output True if the sequence is geometric or False otherwise.

inputFormat

The input is provided via stdin and consists of two lines:

  1. The first line contains a single integer \(n\) which represents the number of elements in the sequence. Note that \(n=0\) represents an empty sequence.
  2. If \(n > 0\), the second line contains \(n\) space-separated numbers. These numbers can be integers or floating-point numbers.

outputFormat

Output a single line to stdout containing either True if the sequence forms a geometric progression, or False otherwise.

## sample
5
2 4 8 16 32
True