1132. Cut Integer (20)
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)的更多相关文章
- 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 ... 
- 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(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[简单]
		1132 Cut Integer(20 分) Cutting an integer means to cut a K digits lone integer Z into two integers o ... 
- PAT 甲级 1132 Cut Integer
		https://pintia.cn/problem-sets/994805342720868352/problems/994805347145859072 Cutting an integer mea ... 
- 1132 Cut Integer
		题意:略. 思路:注意除数可能为0的情况,不然会导致浮点错误. 代码: #include <iostream> #include <string> using namespac ... 
- PAT1132: Cut Integer
		1132. Cut Integer (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Cutting a ... 
- PAT_A1132#Cut Integer
		Source: PAT A1132 Cut Integer (20 分) Description: Cutting an integer means to cut a K digits lone in ... 
- PAT-1132(Cut Integer )数的拆分+简单题
		Cut Integer PAT-1132 #include<iostream> #include<cstring> #include<string> #includ ... 
随机推荐
- Linux 进程管理 kill、killall、pkill命令
			Linux常用信号(进程间通信) 系统中可以识别的信号较多,我们可以使用命令"kill -l"或"man 7 signal"来查询.命令如下: [root@lo ... 
- RPC数据通信
			RPC全称为Remote Procedure Call,翻译过来为“远程过程调用”.目前,主流的平台中都支持各种远程调用技术,以满足分布式系统架构中不同的系统之间的远程通信和相互调用.远程调用的应用场 ... 
- String类型是特殊的引用类型
			例证: string peom1 = "Kubla Khan"; string peom2 = "Kubla Khan"; string peom3 = Str ... 
- Asp.Net中OnClientClick与OnClick的区别
			当我们当击这个按钮时,自动先执行的客户端,再执行服务器端的.如果客户端返回的是false,那么服务器端对应的方法永远不会执行.这样就达到检测,只有通过才去执行服务器端的方法. 
- 【Head First Servlets and JSP】笔记22:直接从请求到JSP & 获取Person的嵌套属性
			直接从请求到JSP,不经过servlet <!DOCTYPE html> <html lang="en"> <head> <meta ch ... 
- 08/27 Django admin相关
			一.django-admin的简单回顾: admin: Django的后台数据管理的web版本 1.admin a:models.py - 创建表 b:admin.py - 注册表 admin. ... 
- 20145222黄亚奇《网络对抗》MSF基础应用
			实践目标 掌握metasploit的基本应用方式. 具体需要完成(1)ms08_067;(2)ms11_050:(3)Adobe(4)成功应用任何一个辅助模块. 实验内容 掌握metasploit的基 ... 
- 20165101刘天野 2018-2019-2《网络对抗技术》Exp5 MSF基础应用
			目录 20165101刘天野 2018-2019-2<网络对抗技术>Exp5 MSF基础应用 1. 实践内容 1.1一个主动攻击实践,如ms08_067; (1分) 1.2 一个针对浏览器 ... 
- Spring中Bean管理的常用注解
			在Spring中,主要用于管理bean的注解分为四大类:1.用于创建对象.2.用于给对象的属性注入值.3.用于改变作用的范围.4.用于定义生命周期.这几个在开发中经常接触到,也可以说每天都会遇见.其中 ... 
- Mybatis配置插入数据返回主键ID
			需要在insert方法中添加 <insert id="insertSelective" parameterType="com.midou.ott.model.MDA ... 
