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 <). 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
 #include <iostream>
#include <string>
using namespace std;
int main()
{
int n, num, a, b;
cin >> n;
while (n--)
{
string str, str1, str2;
cin >> str;
str1.assign(str.begin(), str.begin() + str.length() / );
str2.assign(str.begin() + str.length() / , str.end());
num = atoi(str.c_str());
a = atoi(str1.c_str());
b = atoi(str2.c_str());
if ((a*b) > && num % (a*b) == )
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return ; }
												

PAT甲级——A1132 Cut Integer的更多相关文章

  1. PAT 甲级 1132 Cut Integer

    https://pintia.cn/problem-sets/994805342720868352/problems/994805347145859072 Cutting an integer mea ...

  2. PAT A1132 Cut Integer (20 分)——数学题

    Cutting an integer means to cut a K digits lone integer Z into two integers of (K/2) digits long int ...

  3. A1132. Cut Integer

    Cutting an integer means to cut a K digits lone integer Z into two integers of (K/2) digits long int ...

  4. PAT Advanced 1132 Cut Integer (20) [数学问题-简单数学]

    题目 Cutting an integer means to cut a K digits long integer Z into two integers of (K/2) digits long ...

  5. 【PAT甲级】1113 Integer Set Partition (25分)

    题意: 输入一个正整数N(2<=N<=1e5),接着输入N个正整数,将这些数字划分为两个不相交的集合,使得他们的元素个数差绝对值最小且元素和差绝对值最大. AAAAAccepted cod ...

  6. 【PAT甲级】1103 Integer Factorization (30 分)

    题意: 输入三个正整数N,K,P(N<=400,K<=N,2<=P<=7),降序输出由K个正整数的P次方和为N的等式,否则输出"Impossible". / ...

  7. PAT_A1132#Cut Integer

    Source: PAT A1132 Cut Integer (20 分) Description: Cutting an integer means to cut a K digits lone in ...

  8. PAT甲级1103. Integer Factorization

    PAT甲级1103. Integer Factorization 题意: 正整数N的K-P分解是将N写入K个正整数的P次幂的和.你应该写一个程序来找到任何正整数N,K和P的N的K-P分解. 输入规格: ...

  9. PAT 1132 Cut Integer

    1132 Cut Integer (20 分)   Cutting an integer means to cut a K digits lone integer Z into two integer ...

随机推荐

  1. this.$router.push

    跳转详情页this.$router.push({ path: `/activityDetails/${id}` })

  2. Struts功能详解——ActionForm

    ActionForm ActionForm用于封装用户的请求参数,而请求参数是通过JSP页面的表单域传递过来的.因此应保证ActionForm的参数,与表单域的名字相同.     ActionForm ...

  3. 单调栈(最大子矩形强化版)——牛客多校第八场A

    求01矩阵里有多少个不同的1矩阵 首先预处理出pre[i][j]表示i上面连续的1个数,对每行的高度进行单调栈处理 栈里的元素维护两个值:pre[i][j]和向前延伸最多能维护的位置pos 然后算贡献 ...

  4. iOS Undefined symbols for architecture armv7:

    armv6 iPhone.iPhone 3G iPod 1G.iPod 2G armv7 iPhone 3GS.iPhone 4 iPod 3G.iPod 4G.iPod 5G iPad.iPad 2 ...

  5. [转]ThinkPHP分页实例

    很多人初学thinkphp时,不太熟悉thinkphp的分页使用方法,现在将自己整理的分页方法分享下,有需要的朋友可以看看.   控制器中的代码:   $db = M("cost" ...

  6. 剑指offer——36二叉树和为某一值的路径

    题目描述 输入一颗二叉树的根节点和一个整数,打印出二叉树中结点值的和为输入整数的所有路径.路径定义为从树的根结点开始往下一直到叶结点所经过的结点形成一条路径.(注意: 在返回值的list中,数组长度大 ...

  7. 转:CSS盒模型

    W3C 组织建议把所有网页上的对像都放在一个盒(box)中,设计师可以通过创建定义来控制这个盒的属性,这些对像包括段落.列表.标题.图片以及层.盒模型主 要定义四个区域:内容(content).边框距 ...

  8. 《DSP using MATLAB》Problem 8.43

    代码: %% ------------------------------------------------------------------------ %% Output Info about ...

  9. mybatis 处理CLOB/BLOB类型数据

    BLOB和CLOB都是大字段类型. BLOB是按二进制来存储的,而CLOB是可以直接存储文字的. 通常像图片.文件.音乐等信息就用BLOB字段来存储,先将文件转为二进制再存储进去.文章或者是较长的文字 ...

  10. 根据单个或多个字段对list对象去重

    pojo  省略 在list 对象中,根据某一字段进行去重,重写Comparator /** * 去重 * * @param orderList * @return * @author ziggo * ...