TopCoder

Caido
$\mathbb{W}\mathcal{aimai}\sim$

User's AC Ratio

90.2% (174/193)

Submission's AC Ratio

40.8% (227/557)

Tags

Description

數學老師請你寫個程式幫他算個問題。
考慮一個整係數一元二次方程式 $ax ^ 2 + bx + c = 0$,
他想知道這個一元二次方程式的兩個解是不是都是有理數。

Input Format

輸入檔的第一行有一個正整數 $M$,代表有 $M$ 組測試資料。
以下的 $M$ 行各有三個正整數 $a, b, c$。所有的數的值都在 $[1, 1000]$ 之間。

Output Format

對於每一組測試資料,
若兩個解都是有理數的話輸出 Yes,不是有理數的話則輸出 No

Sample Input 1

1
1 2 1

Sample Output 1

Yes

Sample Input 2

3
1 2 1
1 2 2
2 10 8

Sample Output 2

Yes
No
Yes

Hints

Problem Source

原TIOJ1716 / TOI2010初選(prob 1)。
2021.03.19 Update: Added $\LaTeX$ by FHVirus

Subtasks

No. Testdata Range Score
1 0 16
2 1 16
3 2 16
4 3 16
5 4 16
6 5 20

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 65536 262144 1
1 1000 65536 262144 2
2 1000 65536 262144 3
3 1000 65536 262144 4
4 1000 65536 262144 5
5 1000 65536 262144 6