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 )数的拆分+简单题的更多相关文章

  1. PAT 1132 Cut Integer[简单]

    1132 Cut Integer(20 分) Cutting an integer means to cut a K digits lone integer Z into two integers o ...

  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 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 ...

  5. 树状数组例题-数星星,简单题easy,校门外的树2,清点人数

    [例1]数星星 天空中有一些星星,这些星星都在不同的位置,每个星星都有个坐标,如果一个星星的左下方(包括正左和正下)有k颗星星,就说这颗星星是k级的. 比如,上图中,星星5是3级的(1,2,4在其左下 ...

  6. PAT 甲级 1132 Cut Integer

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

  7. 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 ...

  8. 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 ...

  9. 1132 Cut Integer

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

随机推荐

  1. hdu2546 饭卡

    Problem Description 电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额.如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负) ...

  2. kubeadm---高可用安装

    1.修改主机名 如何使用hostnamectl set-hostname name来为每台主机设置不同的机器名 #hostnamectl set-hostname k8s-master01 或者使用以 ...

  3. python = 赋值顺序 && C++ side effect

    title: python = 赋值顺序 && C++ side effect date: 2020-03-17 15:00:00 categories: [python][c++] ...

  4. pyspark+anaconda配置

    参考 https://www.e-learn.cn/content/python/786199 注意 所有的变量都放在环境变量而非用户变量.比如JAVA_HOME. 不然虽然pyspark没问题,但是 ...

  5. Java之先行发生原则与volatile关键字详解

    volatile关键字可以说是Java虚拟机提供的最轻量级的同步机制,但是它并不容易完全被正确.完整地理解,以至于许多程序员都习惯不去使用它,遇到需要处理多线程数据竞争问题的时候一律使用synchro ...

  6. 牛客多校第六场G Is Today Friday?(吉姆拉尔森/蔡勒公式 + 思维)题解

    题意: 给你\(A-J\)的字母组成的日期,形式为\(yyyy/mm/dd\).现给你\(n\)个这样的串\((n<=1e5)\),问你把字母映射成数字,并且使得所有日期合法且为星期五的最小字典 ...

  7. 2019牛客多校第四场B xor(线性基求交)题解

    题意: 传送门 给\(n\)个集合,每个集合有一些数.给出\(m\)个询问,再给出\(l\)和\(r\)和一个数\(v\),问你任意的\(i \in[l,r]\)的集合,能不能找出子集异或为\(v\) ...

  8. element-ui UI 组件库剖析

    element-ui UI 组件库剖析 /* Automatically generated by './build/bin/build-entry.js' */ https://github.com ...

  9. STAR 法则

    STAR 法则 STAR: Situation, Task, Action, Result 一. 什么是 STAR 法则? STAR法则是情境(situation).任务(task).行动(actio ...

  10. illustrating javascript prototype & prototype chain

    illustrating javascript prototype & prototype chain 图解 js 原型和原型链 proto & prototype func; // ...