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. [转]十五天精通WCF——终结篇 那些你需要注意的坑

    终于一路走来,到了本系列的最后一篇了,这一篇也没什么好说的,整体知识框架已经在前面的系列文章中讲完了,wcf的配置众多,如果 不加一些指定配置,你可能会遇到一些灾难性的后果,快来一睹为快吧. 一: 第 ...

  2. Android中@+id和@id的差别

    Android中的组件须要用一个int类型的值来表示.这个值也就是组件标签中的id属性值. id属性仅仅能接受资源类型的值,也就是必须以@开头的值,比如,@id/abc.@+id/xyz等.  假设在 ...

  3. UINavigationController具体解释(一)

    @UINavigationControlle简单介绍: 1.导航控制器,专门管理控制器的控制器. 2.採用栈的方式管理全部controller,每一个controller管理各自的视图 @UINavi ...

  4. 01背包--小P寻宝记——粗心的基友

    题目描写叙述 这对好基友他们在经历无数的艰难险阻后.最终找到了宝藏.无奈的是这一对好基友居然是一样的粗心,又忘记了带一个大一点的包包,可惜啊..选择又出现了啊.. 已知包的体积是v,每种宝贝仅仅有一种 ...

  5. xtrabackup 2.3.3编译安装

    ***************************************************************** 安装 ******************************* ...

  6. LeetCode——Valid Number

    Validate if a given string is numeric. Some examples: "0" => true " 0.1 " =&g ...

  7. 1360 xth 的玫瑰花

    1360 xth 的玫瑰花  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 钻石 Diamond 题解       题目描述 Description 这天是rabbit 的生日 ...

  8. oc36--自定义构造方法在继承中的表现

    // // Person.h #import <Foundation/Foundation.h> @interface Person : NSObject @property int ag ...

  9. Ubuntu Linux 安装 .7z 解压和压缩文件

    安装方法: sudo apt-get install p7zip 解压文件: 7z x manager.7z -r -o /home/xx解释如下:x 代表解压缩文件,并且是按原始目录解压(还有个参数 ...

  10. android recovery 主系统代码分析【转】

    本文转载自:http://blog.csdn.net/andyhuabing/article/details/9248713 阅读完上一篇文章: http://blog.csdn.net/andyhu ...