Source:

PAT A1132 Cut Integer (20 分)

Description:

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

Keys:

  • 快乐模拟

Attention:

  • 除法注意考虑分母为零的情况

Code:

 /*
Data: 2019-05-24 21:36:30
Problem: PAT_A1132#Cut Integer
AC: 18:02 题目大意:
根据题意切割整数
输入:
第一行给出,测试数N;
接下来N行,给出Z
输出:
是否能够找到符合条件的A和B,输出Yes or No
*/ #include<cstdio>
typedef long long LL; int main()
{
#ifdef ONLINE_JUDGE
#else
freopen("Test.txt", "r", stdin);
#endif LL m,n;
scanf("%lld", &m);
while(m--)
{
scanf("%lld", &n);
LL exp=,a,b;
while(exp*exp<n)
exp *= ;
a = n%exp;
b = n/exp;
if(a!= && b!= && n%(a*b)==)
printf("Yes\n");
else
printf("No\n");
} return ;
}

PAT_A1132#Cut Integer的更多相关文章

  1. PAT1132: Cut Integer

    1132. Cut Integer (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Cutting a ...

  2. PAT 1132 Cut Integer

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

  3. PAT 1132 Cut Integer[简单]

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

  4. pat 1132 Cut Integer(20 分)

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

  5. PAT-1132(Cut Integer )数的拆分+简单题

    Cut Integer PAT-1132 #include<iostream> #include<cstring> #include<string> #includ ...

  6. A1132. Cut Integer

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

  7. 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 ...

  8. PAT 甲级 1132 Cut Integer

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

  9. 1132. Cut Integer (20)

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

随机推荐

  1. [Algorithms] The Bayes Rule

    Prior odd: The idea is to take the odds for something happening (against it not happening), which we ...

  2. &lt;转&gt;Openstack Ceilometer监控项扩展

    Openstack ceilometer主要用于监控虚拟机.服务(glance.image.network等)和事件.虚拟机的监控项主要包含CPU.磁盘.网络.instance.本文在现有监控项的基础 ...

  3. WINDOWS下配置SVN代码管理

    服务器端使用 visualsvn server,客户端使用tortoiseSvn. 一.服务器端 1.首先,下载visualsvn server,安装到服务器.下载地址: http://www.vis ...

  4. UESTC--1253--阿里巴巴和n个大盗 (博弈)

     阿里巴巴和n个大盗 Time Limit: 1000MS   Memory Limit: 65535KB   64bit IO Format: %lld & %llu Submit St ...

  5. Too-Java:Intellij Idea

    ylbtech-Too-Java:Intellij Idea IDEA 全称 IntelliJ IDEA,是java编程语言开发的集成环境.IntelliJ在业界被公认为最好的java开发工具之一,尤 ...

  6. [Apple开发者帐户帮助]三、创建证书(7)创建证书签名请求

    Mac上的Keychain Access允许您创建证书签名请求(CSR). 启动位于的Keychain Access /Applications/Utilities. 选择Keychain Acces ...

  7. Python 40 数据库-外键约束 、多对一与多对多的处理

    mysql提供了 foreign key,专门用于为表和表之间 建立物理关联 思考 表里存储的是一条条的记录,两个表之间能产生的关系有哪些? 现有 A B两张表 1.多对一         2.一对一 ...

  8. rabbitmq普通集群搭建详细步骤

    由于工作需求,需要安装rabbitmq,学习之余,记录一下安装过程 准备基础编译环境yum install gcc glibc-devel make ncurses-devel openssl-dev ...

  9. 使用node成功安装完某插件typescript后,在使用时提示:tsc(或xxx)不是内部或外部命令,也不是可运行的程序或批处理文件

    具体出错情形: 使用npm安装typescript明明安装成功,但在使用时一直报错,报错语句为  tsc不是内部或外部命令,也不是可运行的程序或批处理文件 具体出错原因: node未正确安装,或相关环 ...

  10. EditPlus 1:更改默认编码方式

    打开软件点击上面的菜单栏Tools(工具),再找到Configure User Tools(用户配置工具)点击,再找到左边栏File点击,这个时候可以看到右边栏的Default encoding点击可 ...