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 ...
随机推荐
- P1541 乌龟棋(DP)
题目背景 小明过生日的时候,爸爸送给他一副乌龟棋当作礼物. 题目描述 乌龟棋的棋盘是一行NNN个格子,每个格子上一个分数(非负整数).棋盘第1格是唯一的起点,第NNN格是终点,游戏要求玩家控制一个乌龟 ...
- C# 之 async / await
直接看一个例子 private async void button1_Click(object sender, EventArgs e) { var t = Task.Run(() => { T ...
- 【转】Dockerfile
1. 关于docker build docker build可以基于Dockerfile和context打包出一个镜像,其中context是一系列在PATH或URL中指定的位置中的文件(contex ...
- 如何创建一个GETH节点(单节点,windows环境)
所有命令都是在powershell上执行的 1.创建"创世块" 初始化配置 创建一个 hdgenesis.json文件,拷贝到geth根目录 { "config&q ...
- Kubernetes安装EFK教程(非存储持久化方式部署)
1.简介 这里所指的EFK是指:ElasticSearch,Fluentd,Kibana ElasticSearch Elasticsearch是一个基于Apache Lucene的开源搜索和数据分析 ...
- hdu 4497 GCD and LCM (非原创)
GCD and LCM Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total ...
- vue中获取元素并控制相应的dom
1 在标签中使用ref="xxx" 2 在methods中调用this.$refs.xxx this.$refs.xxx.$el获取dom 注意1:大多数情况下为了复用方法,将xx ...
- HDU 4628 Pieces(状压DP)题解
题意:n个字母,每次可以删掉一组非连续回文,问你最少删几次 思路:把所有回文找出来,然后状压DP 代码: #include<set> #include<map> #includ ...
- matplotlib 单figure多图
method 1 import numpy as np import matplotlib.pyplot as plt fg, axes = plt.subplots(1, 2, figsize=(1 ...
- VuePress 最新教程
VuePress 最新教程 https://vuepress.vuejs.org/ https://github.com/vuejs/vuepress VuePress plugins 插件通常会为 ...