字符串处理 pat1132

//1132
//substr(a,b) a 为起始位置,b 为个数
//用于截取字符串
#include <iostream>
#include<stdio.h>
#include<string>
#include<algorithm>
#include<string.h>
using namespace std;


int main()
{
       freopen("1132.txt","r",stdin);
       int n;
       cin>>n;
       for(int i = 0; i < n; i++){
              string s;
              cin>>s;
              string s1, s2;
              int len = s.length();
              s1 = s.substr(0,len/ 2);
              s2 = s.substr(len / 2, len / 2);
              int a = stoi(s), b = stoi(s1), c = stoi(s2);
              if((b*c)!=0 && a%(b*c)==0){//(b*c)!=0 ,不然会出现浮点错误
                     printf("Yes\n");
              }else printf("No\n");
       }

    //cout << "Hello world!" << endl;
    return 0;
}

 

上一篇:LCD显示GPS时钟[嵌入式系统]


下一篇:对称平方数(to_string函数,stoi函数真香)