编程介的小学生 2018-12-07 15:34 采纳率: 20.5%
浏览 506
已采纳

判断一个序列是不是等比级数。用C语言解答这个问题怎么做呢?

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 rk of a fixed number r, such as 2k and 3k. The general form of a geometric sequence is

a, ar, ar2, ar3, ar4, …

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≤20) which denotes the number of test cases.

For each test case, there is an positive integer n(1≤n≤100) which denotes the length of sequence,and next line has n nonnegative numbers Ai which allow leading zero.The digit's length of Ai 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

  • 写回答

2条回答 默认 最新

  • threenewbee 2019-03-28 23:46
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?