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
Yesif it is such a number, orNoif 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 ...
随机推荐
- [bzoj3747][POI2015]Kinoman_线段树
Kinoman bzoj-3747 POI-2015 题目大意:有m部电影,第i部电影的好看值为w[i].现在放了n天电影,请你选择一段区间l~r使得l到r之间的好看值总和最大.特别地,如果同一种电影 ...
- FOJ 10月赛题 FOJ2198~2204
A题. 发现是递推可以解决这道题,a[n]=6*a[n-1]-a[n-2].因为是求和,可以通过一个三维矩阵加速整个计算过程,主要是预处理出2^k时的矩阵,可以通过这道题 #include <i ...
- 我在SharePoint行业的从业经历(二)
本文是我的SharePoint从业经历的第二篇,第一篇请參考 我在SharePoint行业的从业经历(一) 做完那个项目之后.对SharePoint 2003有了一些认识. 可是后来几年我就没在 ...
- Linux下RTC时间的读写分析【转】
本文转载自:http://blog.csdn.net/little_walt/article/details/52880840 Linux系统下包含两个时间:系统时间和RTC时间. 系统时间:是由主芯 ...
- Android内存解析(一)—从Linux系统内存逐步认识Android应用内存
总述 Android应用程序被限制了内存使用上限,一般为16M或24M(具体看系统设置),当应用的使用内存超过这个上限时,就会被系统认为内存泄漏,被kill掉.所以在android开发时,管理好内存的 ...
- java的list类
java的list类 目录: list中添加,获取,删除元素: list中是否包含某个元素: list中根据索引将元素数值改变(替换): list中查看(判断)元素的索引: 根据元素索引位置进行的判断 ...
- Appium + python -always_allows弹窗
from appium import webdriverfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.web ...
- 关于sklearn中的导包交叉验证问题
机器学习sklearn中的检查验证模块: 原版本导包: from sklearn.cross_validation import cross_val_score 导包报错: 模块继承在cross_va ...
- 前端布局神器 display:flex
前端布局神器display:flex 一直使用flex布局,屡试不爽,但是总是记不住一些属性,这里写来记录一下. 2009年,W3C提出了一种新的方案--Flex布局,可以简便.完整.响应式地实现 ...
- 知识总结1:debug命令汇总(一)
-r 得到当前寄存器状态或修改寄存器状态 -d 跳到默认(CS:IP指定的地址)区间 -d 段地址:偏移地址 跳到(段地址*+偏移地址)区间 -d 段地址:起始偏移地址 终止偏移地址 跳到(段地址*+ ...