Codeforces Global Round 26
B
Large Addition
Codeforces
1100
原题
← AC1 →
翻译中…

A digit is large if it is between $5$ and $9$, inclusive. A positive integer is large if all of its digits are large.

翻译中…

You are given an integer $x$. Can it be the sum of two large positive integers with the same number of digits?

翻译中…

Input

翻译中…

The first line contains a single integer $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

翻译中…

The only line of each test case contains a single integer $x$ ($10 \leq x \leq 10^{18}$).

翻译中…

Output

翻译中…

For each test case, output $\texttt{YES}$ if $x$ satisfies the condition, and $\texttt{NO}$ otherwise.

翻译中…

You can output $\texttt{YES}$ and $\texttt{NO}$ in any case (for example, strings $\texttt{yES}$, $\texttt{yes}$, and $\texttt{Yes}$ will be recognized as a positive response).

翻译中…

Note

翻译中…

In the first test case, we can have $658 + 679 = 1337$.

翻译中…

In the second test case, it can be shown that no numbers of equal length and only consisting of large digits can add to $200$.

翻译中…

In the third test case, we can have $696\,969 + 696\,969 = 1\,393\,938$.

翻译中…

In the fourth test case, we can have $777 + 657 = 1434$.

翻译中…

样例

Input #1
11
1337
200
1393938
1434
98765432123456789
11111111111111111
420
1984
10
69
119
Output #1
YES
NO
YES
YES
NO
YES
NO
YES
YES
NO
NO
InputCopy OutputCopy
题目信息
题号
1984B
时间限制
1 s
内存限制
256 MB
标签
模拟
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。