Cutting an integer means to cut a K digits long 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 x 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<=231). 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 代码:
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std;
int coun(int d)
{
int c = ;
while(d)
{
c ++;
d /= ;
}
return c;
}
int main()
{
int n,d;
scanf("%d",&n);
while(n --)
{
scanf("%d",&d);
int s = coun(d),p = ;
s /= ;
for(int i = ;i < s;i ++)
p *= ;
s = (d/p)*(d%p);///如果是0不能做取模
if(s && d % s == )printf("Yes\n");
else printf("No\n");
}
}

1132. Cut Integer (20)的更多相关文章

  1. PAT Advanced 1132 Cut Integer (20) [数学问题-简单数学]

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

  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(20 分)

    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[简单]

    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

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

  6. 1132 Cut Integer

    题意:略. 思路:注意除数可能为0的情况,不然会导致浮点错误. 代码: #include <iostream> #include <string> using namespac ...

  7. PAT1132: Cut Integer

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

  8. PAT_A1132#Cut Integer

    Source: PAT A1132 Cut Integer (20 分) Description: Cutting an integer means to cut a K digits lone in ...

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

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

随机推荐

  1. jmeter常用插件安装

    转载:http://www.cnblogs.com/danqiu/p/6119156.html 下载地址:http://jmeter-plugins.org/downloads/all/ PerfMo ...

  2. 【c++习题】【17/4/13】stack

    1.stack 模板.动态内存分配.析构 #include "stack2.cpp" #include <iostream> using namespace std; ...

  3. ES6 完全使用手册

    前言 这里的 "ES6" 泛指 ES5 之后的新语法 这里的 "完全" 是指本文会不断更新 这里的 "使用" 是指本文会展示很多 ES6 的 ...

  4. lua身份证号码验证~

    --验证身份证信息 --只支持18位身份证的验证 --[[ #身份证18位编码规则:dddddd yyyymmdd xxx y #dddddd:地区码 #yyyymmdd: 出生年月日 #xxx:顺序 ...

  5. Socket初步了解

    在这之前我们先了解一下一些关于网络编程的概念 网络编程从大方面说就是对信息的发送和接收,中间传输为物理线路的作用,编程人员可以不用考虑 网络编程最主要的工作就是在发送端吧信息通过规定好的协议进行组装包 ...

  6. java对象的深浅clone

    在Java语言中,数据类型分为值类型(基本数据类型)和引用类型,值类型包括int.double.byte.boolean.char等简单数据类型,引用类型包括类.接口.数组等复杂类型. 浅克隆和深克隆 ...

  7. angularjs1 自定义轮播图(汉字导航)

    本来想用swiper插件的,可是需求居然说要汉字当导航栏这就没办法了,只能自己写. directive // 自定义指令: Home页面的轮播图 app.directive('swiperImg', ...

  8. 阿里云 centOS7.4新装nginx 不能访问

    反复装了几遍ngxin,什么防火墙,nginx.conf改了好几次都不能访问外网的ip, 原因是阿里云这货新的服务器根本就没开通443,80端口,真是坑人啊 点击配置规则,增加端口就行了 添加安全规则 ...

  9. Coundn't load memtrack module (No such file or directory)

    Coundn't load memtrack module (No such file or directory) 去仔细看日志,是包名有问题 一.出现症状 提示找logcat logcat里面发现C ...

  10. selenium学习笔记(鼠标事件)

    昨天是简单的操作.之后是复杂的操作 首先是鼠标事件 AcationChains类  鼠标操作的常用方法: 右击 context_click() 双击 double_click() 拖动      dr ...