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. 使用sql对比Mysql中数据库2个表结构

    比较两个数据表的结构 SELECT column_name, max( CASE WHEN table_name = 'table1' AND table_schema = 'db1' THEN 'Y ...

  2. jQuery实现全选与全部选

    为了便于用户理解,直接粘贴下面的代码即可 <!DOCTYPE html> <html lang="en"> <head> <meta ch ...

  3. centos7 dns(bind)安装配置

    yum install -y bind bind-chroot bind-utils chroot是通过相关文件封装在一个伪根目录内,已达到安全防护的目的,一旦程序被攻破,将只能访问伪根目录内的内容, ...

  4. Vue.js和Webpack

    Vue.js Vue简单介绍 是一个轻量级的渐进式框架,一个前端项目可以使用使用Vue.js的一两个特性也可以整个项目都用Vue.js,很方便实现项目的增量开发 Vue.js的使用:() 在html页 ...

  5. Bootstrap快速入门并且建立常用模板

    对于移动端,能够快速搭建网站,操作相对简单 ,更容易掌握,这篇文章就介绍一下BootStrap 一  什么是Bottstrap 一个前端开发的框架,Bootstrap,来自 Twitter,是目前很受 ...

  6. delphi 压缩

    DELPHI 通过ZLib来压缩文件夹 unit Unit1; interface uses ZLib, Windows, Messages, SysUtils, Variants, Classes, ...

  7. (转)VS2010-MFC编程入门教程之目录和总结

     目前该教程可以到鸡啄米编程课堂去学习,阅读体验更好,更适合在线学习. 原文目录及链接: 一.VS2010/MFC编程入门教程之目录 第一部分:VS2010/MFC开发环境 VS2010/MFC编程入 ...

  8. 第37讲 谈谈Spring Bean的生命周期和作用域

    在企业应用软件开发中,Java 是毫无争议的主流语言,开放的 Java EE 规范和强大的开源框架功不可没,其中 Spring 毫无疑问已经成为企业软件开发的事实标准之一.今天这一讲,我将补充 Spr ...

  9. sklearn中模型抽取

    特征抽取sklearn.feature_extraction 模块提供了从原始数据如文本,图像等众抽取能够被机器学习算法直接处理的特征向量. 1.特征抽取方法之 Loading Features fr ...

  10. [POI2011]SMI-Garbage

    题目描述 http://main.edu.pl/en/archive/oi/18/smi The Byteotian Waste Management Company (BWMC) has drast ...