字符串处理 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;
}
标签:substr,int,s2,len,处理,stoi,字符串,pat1132,include 来源: https://blog.csdn.net/BuGengFeng/article/details/100139347