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 ...
随机推荐
- cogs 826. [Tyvj Feb11] GF打dota
826. [Tyvj Feb11] GF打dota ★★☆ 输入文件:dota.in 输出文件:dota.out 简单对比时间限制:1 s 内存限制:128 MB 众所周知,GF同学喜 ...
- HDU 4529
好题.果然好题,经典了. 列一个计划,清明前做好状压DP.之后就刷剩下的MULTI. #include <iostream> #include <cstdio> #includ ...
- source 命令的用法,是在当前bash环境下执行脚本文件
原文: http://www.cnblogs.com/softwaretesting/archive/2012/02/13/2349550.html source命令用法: source FileNa ...
- SpringMVC案例2----基于spring2.5的注解实现
和上一篇一样,首先看一下项目结构和jar包 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYmVuamFtaW5fd2h4/font/5a6L5L2T/fo ...
- HDU 2665(主席树,无修改第k小)
Kth number Time Limit: 15000/5000 MS (Java/Others) ...
- hihocoder 1680 hiho字符串2 dp求方案数+递归
我们定义第一代hiho字符串是"hiho". 第N代hiho字符串是由第N-1代hiho字符串变化得到,规则是: h -> hio i -> hi o -> ho ...
- 520D
模拟 很明显应该尽量选最大或最小的数.那么我们维护一个set,再维护一个mp,每次检查是否能选,如果选完这个数上面的东西不悬空就可以选,每次选完都要更新四周-2+2的方块,因为再远就影响不到了 #in ...
- PCB 奥宝LDI 输出 轴交换与镜像关系
持续P2 奥宝LDI改造,针对轴交换与镜像关系整理如下:(标记) 关键参数说明: 轴交换swap_axes: 当为Yes,则图形--镜像+旋转90度,当为No,则图形--不动 xmirror与ymir ...
- B - Eleven
Problem description Eleven wants to choose a new name for herself. As a bunch of geeks, her friends ...
- SHRINK SPACE Command : Online Segment Shrink for Tables, LOBs and IOTs
ORACLE-BASE - ALTER TABLE ... SHRINK SPACE Command : Online Segment Shrink for Tables, LOBs and IOTs ...