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 ...
随机推荐
- HDU 3537 Daizhenyang's Coin 翻硬币博弈
题意: 给你n个硬币,你可以从中拿出来1.2.3个硬币,它们不一定要连续,你只需要保证拿出来的硬币中那个下标最大的硬币一定要是正面朝上,最后谁不能操作,谁就输了 题解: 翻硬币游戏 结论: 局面的SG ...
- 说说Golang goroutine并发那些事儿
摘要:今天我们一起盘点一下Golang并发那些事儿. Golang.Golang.Golang 真的够浪,今天我们一起盘点一下Golang并发那些事儿,准确来说是goroutine,关于多线程并发,咱 ...
- JavaScript调试技巧之console.log()
与alert()函数类似,console.log()也可以接受变量并将其与别的字符串进行拼接: 代码如下: //Use variable var name = "Bob"; con ...
- In_array()函数弱比较
0x01 定义 (PHP 4, PHP 5, PHP 7) in_array - 检查数组中是否存在某个值 说明 in_array ( mixed $needle , array $haystack ...
- Vue2.0 多种组件传值方法-不过如此的 Vuex
码文不易啊,转载请带上本文链接呀,感谢感谢 https://www.cnblogs.com/echoyya/p/14404397.html 在vue项目中了解组件间通讯很重要,也是最基础的面试题,可以 ...
- TypeScript constructor public cause duplicate bug
TypeScript constructor public cause duplicate bug constructor public const log = console.log; // con ...
- JWT All In One
JWT All In One OAuth 2.0 JWT JSON Web Tokens https://jwt.io refs https://www.cnblogs.com/xgqfrms/tag ...
- fullstack web projects in action
fullstack web projects in action web 全栈项目实战 Angular 全栈 Angular + TypeScript + Nest.js + PostgreSQL + ...
- let & var & initialized bug
let & var & initialized bug what's wrong with this? https://github.com/lydiahallie/javascrip ...
- vue & dynamic components
vue & dynamic components https://vuejs.org/v2/guide/components-dynamic-async.html keep-alive htt ...