CF2050C Uninteresting Number
题目描述
给定一个数字 $n$,它的长度最多为 $10^5$。
你可以进行以下操作任意次数:选择它的某一位数字,将该数字平方,并将原来的数字替换成平方后的结果。新的数字必须是一个数字(即,如果你选择数字 $x$,那么 $x^2$ 必须小于 $10$)。
你的任务是判断,是否可以通过这些操作,将这个数字变成一个可以被 $9$ 整除的数字?
输入格式
第一行输入一个整数 $t$($1 \le t \le 10^4$),表示测试用例的个数。
对于每个测试用例:
- 第一行输入一个数字 $n$,该数字没有前导零,并且它的长度不超过 $10^5$。
输出格式
对于每个测试用例,输出 "YES" 如果可以通过上述操作得到一个可以被 $9$ 整除的数字,否则输出 "NO"。
你可以随意输出 "YES" 或 "NO" 的大小写形式,比如 "yEs"、"yes"、"Yes" 和 "YES" 都是有效的答案。
说明/提示
In the first example, from the integer $ 123 $ , it is possible to obtain only $ 123 $ , $ 143 $ , $ 129 $ , and $ 149 $ , none of which are divisible by $ 9 $ .
In the second example, you need to replace the second digit with its square; then $ n $ will equal $ 342 = 38 \cdot 9 $ .
In the third example, the integer is already divisible by $ 9 $ .