## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

# [Solution] Difference Operations Codeforces Solution

A. Difference Operations
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You are given an array $a$ consisting of $n$ positive integers.

You are allowed to perform this operation any number of times (possibly, zero):

• choose an index $i$ ($2\le i\le n$), and change ${a}_{i}$ to ${a}_{i}-{a}_{i-1}$.

Is it possible to make ${a}_{i}=0$ for all $2\le i\le n$?

Input

The input consists of multiple test cases. The first line contains a single integer $t$ ($1\le t\le 100$)  — the number of test cases. The description of the test cases follows.

The first line contains one integer $n$ ($2\le n\le 100$) — the length of array $a$.

Solution Click Below:-  👉
👇👇👇👇👇

The second line contains $n$ integers ${a}_{1},{a}_{2},\dots ,{a}_{n}$ ($1\le {a}_{i}\le {10}^{9}$).

Output

For each test case, print "YES" (without quotes), if it is possible to change ${a}_{i}$ to $0$ for all $2\le i\le n$, and "NO" (without quotes) otherwise.

Difference Operations Codeforces Solution

Difference of GCDs Codeforces Solution

Doremy's IQ Codeforces Solution

Difference Array Solution Codeforces

Partial Virtual Trees Codeforces Solution

DFS Trees Codeforces Solution

You can print letters in any case (upper or lower).