编程介的小学生 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条)

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改