PAT_A1132#Cut Integer
Source:
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, orNo
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的更多相关文章
- PAT1132: Cut Integer
1132. Cut Integer (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Cutting a ...
- PAT 1132 Cut Integer
1132 Cut Integer (20 分) Cutting an integer means to cut a K digits lone integer Z into two integer ...
- PAT 1132 Cut Integer[简单]
1132 Cut Integer(20 分) Cutting an integer means to cut a K digits lone integer Z into two integers o ...
- 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 ...
- PAT-1132(Cut Integer )数的拆分+简单题
Cut Integer PAT-1132 #include<iostream> #include<cstring> #include<string> #includ ...
- A1132. Cut Integer
Cutting an integer means to cut a K digits lone integer Z into two integers of (K/2) digits long int ...
- 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 ...
- PAT 甲级 1132 Cut Integer
https://pintia.cn/problem-sets/994805342720868352/problems/994805347145859072 Cutting an integer mea ...
- 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 ...
随机推荐
- Introduction(本书简介)
本书简介 本书将从三个方面权威的阐述如何提高.net app 性能问题: 验证.测量性能指标,然后辨别它是否超过度量 从内存管理.网络.I/O.并发等方面提高应用程序的性能 通过CLR的详细的设计细节 ...
- CF #316 DIV2 D题
D. Tree Requests time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...
- 1.7-BGP⑥
BGP中的路由控制/过滤: LAB1:Distribute-list调用ACL(较落后) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Step1:通过ACL定义 ...
- [Angular] Why should we using Protal
Origianl article Protal from Angular CDK, is a way to create dynammic component. Consider an example ...
- 深入分析JavaWeb Item38 -- 监听器(Listener)高速学习
一.监听器介绍 1.1.监听器的概念 监听器是一个专门用于对其它对象身上发生的事件或状态改变进行监听和对应处理的对象,当被监视的对象发生情况时,马上採取对应的行动.监听器事实上就是一个实现特定接口的普 ...
- poj 2931 Building a Space Station <克鲁斯卡尔>
Building a Space Station Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 5869 Accepted: 2 ...
- web压力測试-Web Bench
1.web bench下载.地址:http://home.tiscali.cz/~cz210552/webbench.html 2.wen bench安装: [root@web111 tmp]#tar ...
- IntelliJ IDEA 问题总结之二(待补充) —— 快捷键、主题样式、导出jar、sqlite
随着对idea的使用,问题越来越多,開始第二篇问题总结. 1.快捷键. 用惯了eclipse再用idea后,快捷键就是一个大问题. 并且网上idea的快捷键有非常多版本号.不知道是不是老版本号和新版本 ...
- uboot 解压缩
在uboot中进行解压缩是非常实用的 uboot中完毕delay 用户进行交互的段 if(BootType == '3') { char *argv[3]; printf(" \n3: ...
- ubuntu下一款有点感觉的 linux音乐播放器 clementine(小橘子))
https://www.clementine-player.org/ 在linux听音乐的感觉确实不是很好,音乐播放器很多.但是仅仅只是数量上的优势,在确实不是很好用.自带的rhythmbox确实很占 ...