当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5429:Geometric Progression

题目描述
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.
输入解释
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$.
输出解释
For each case, output "Yes" or "No".
输入样例
4
1
0
3
1 1 1
3
1 4 2
5
16 8 4 2 1
输出样例
Yes
Yes
No
Yes
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5429

最后修改于 2020-10-25T23:22:35+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/65536K(Java/Others)