F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Geometric Progression

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1294    Accepted Submission(s): 383


Problem Description
Determine whether a sequence is a Geometric progression or not.

In mathematics, a **geometric progression**, also known as a **geometric sequence**, is a sequence of numbers where each term after the first is found by multiplying the previous one by a fixed, non-zero number called the common ratio. For example, the sequence 2, 6, 18, 54, ... is a geometric progression with common ratio 3. Similarly 10, 5, 2.5, 1.25, ... is a geometric sequence with common ratio 1/2.

Examples of a geometric sequence are powers $r^k$ of a fixed number r, such as $2^k$ and $3^k$. The general form of a geometric sequence is

$a,\ ar,\ ar^2,\ ar^3,\ ar^4,\ \ldots$

where r ¡Ù 0 is the common ratio and a is a scale factor, equal to the sequence's start value.
 

Input
First line contains a single integer $T (T \leq 20)$ which denotes the number of test cases.

For each test case, there is an positive integer $n (1 \leq n \leq 100)$ which denotes the length of sequence,and next line has $n$ nonnegative numbers $A_i$ which allow leading zero.The digit's length of $A_i$ no larger than $100$.
 

Output
For each case, output "Yes" or "No".
 

Sample Input
4 1 0 3 1 1 1 3 1 4 2 5 16 8 4 2 1
 

Sample Output
Yes Yes No Yes
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 15:56:41, Gzip enabled