Cutting an integer means to cut a K digits lone integer Z into two integers of (K/2) digits long integers A and B. For example, after cutting Z = 167334, we have A = 167 and B = 334. It is interesting to see that Z can be devided by the product of A and B, as 167334 / (167 × 334) = 3. Given an integer Z, you are supposed to test if it is such an integer.
Input Specification:
Each input file contains one test case. For each case, the first line gives a positive integer N (≤ 20). Then N lines follow, each gives an integer Z (10 ≤ Z <2^31 ). It is guaranteed that the number of digits of Z is an even number.
Output Specification:
For each case, print a single line Yes if it is such a number, or No if not.
Sample Input:
3
167334
2333
12345678
Sample Output:
Yes
No
No
题意
将一个数字Z(输入保证长度为偶数)拆分成两个数字A、B,如果这两个数字的乘积是原数字的因子,则输出Yes,否则输出No。
思路
因为输出的是一个大整数,所以使用字符串存储,拆分。拆分后的数字可能包含0,所以输出Yes的条件是两个因子的乘积不为0,且Z整除(A * B)。
代码
#include <cstdio>
#