PAT-1132(Cut Integer )数的拆分+简单题
Cut Integer
PAT-1132
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdio>
#include<sstream>
#include<cstdlib>
using namespace std;
int main(){
int n;
cin>>n;
while(n--){
int z;
cin>>z;
stringstream ss;
ss<<z;
string now=ss.str();
int len=now.length();
string a=now.substr(0,len/2);
string b=now.substr(len/2,len);
int sa=stoi(a);
int sb=stoi(b);
if(sa*sb==0){
cout<<"No"<<endl;
continue;
}
if(z%(sa*sb)==0)
cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
return 0;
}
PAT-1132(Cut 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
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 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 ...
- 树状数组例题-数星星,简单题easy,校门外的树2,清点人数
[例1]数星星 天空中有一些星星,这些星星都在不同的位置,每个星星都有个坐标,如果一个星星的左下方(包括正左和正下)有k颗星星,就说这颗星星是k级的. 比如,上图中,星星5是3级的(1,2,4在其左下 ...
- PAT 甲级 1132 Cut Integer
https://pintia.cn/problem-sets/994805342720868352/problems/994805347145859072 Cutting an integer mea ...
- 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 ...
- 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 ...
- 1132 Cut Integer
题意:略. 思路:注意除数可能为0的情况,不然会导致浮点错误. 代码: #include <iostream> #include <string> using namespac ...
随机推荐
- 牛客练习赛63 C.牛牛的揠苗助长
题意:有一个长度为\(n\)的数组,从第一天开始,第\(i\)天可以使\(i\)位置上的数\(+1\),当\(i=n\)时,下次从\(i=1\)再开始,另外,在每天结束时,你可以使任意一个位置上的数\ ...
- Linux程序设计——Linux基础
1. 什么是Linux 1)Linux系统是一种自由和开放源代码的类UNIX的完整操作系统. 2)林纳斯·本纳第克特·托瓦兹(LinusBenedictTorvalds,1969年~) 3)诞生于19 ...
- 实战交付一套dubbo微服务到k8s集群(8)之configmap使用
使用ConfigMap管理应用配置 拆分环境 主机名 角色 IP地址 mfyxw10.mfyxw.com zk1.od.com(Test环境) 192.168.80.10 mfyxw20.mfyxw. ...
- 7.Topic交换机之模拟文件分类
标题 : 7.Topic交换机之模拟文件分类 目录 : RabbitMQ 序号 : 7 Password = "123456", AutomaticRecoveryEnabled ...
- markdown嵌入图片
这里嵌入指不会因为本地文件丢失而丢失. 参考:https://blog.csdn.net/testcs_dn/article/details/78952358 https://blog.csdn.ne ...
- HDU 3920 Clear All of Them I(状压DP)题解
题意:2n个点,一个起点,开n枪,每枪必须打两个点,花费为起点到其中一点距离加上两点距离.问打完2n个点的最小花费. 思路:很显然应该dp状态,然后枚举i j两个空位置去填,那么复杂度$O(20 * ...
- SQLite在C#的使用
SQLite在C#的使用 http://www.cnblogs.com/SharkBin/archive/2012/11/03/2752277.html System.Data.SQLite.DLL的 ...
- Github markdown页面内跳转
基本操作: 请看这里 最典型的就是[alt_content](#jump) 但有时, jump是不太好直接看出来的, 比如下面这个标题, 格式复杂, 那如何获取相应的jump呢? 在Github中, ...
- TypeScript with React
TypeScript with React # Make a new directory $ mkdir react-typescript # Change to this directory wit ...
- Firewall & Network Security
Firewall & Network Security 防火墙 & 网络安全 NAT Gateway VPC Virtual Private Cloud refs https://en ...