Module b
Expand description
§ABC 390 B - Geometric Sequence
refs: https://atcoder.jp/contests/abc390/tasks/abc390_b
除算が入らない形で比較したほうが良い.
use proconio::input;
fn main() {
input! {
n: usize,
a: [usize; n],
}
if n <= 2 {
println!("Yes");
return;
}
for i in 1..(n - 1) {
if a[i] * a[i] != a[i - 1] * a[i + 1] {
println!("No");
return;
}
}
println!("Yes");
}