A1132
Description:
给一个数字(位数为偶数),对半分成两个数,若原数可以整数两数之积,即输出Yes;
思路:
- 模运算要先判断一下模数是否为零;
- 主要是stoi函数应用;
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
int main()
{
#ifdef ONLINE_JUDGE
#else
freopen("1.txt", "r", stdin);
#endif // ONLINE_JUDGE
string num;
int n;
scanf("%d", &n);
for(int i = 0;i < n; i++){
cin>>num;
int len = num.size()/2;
int ori = stoi(num);
int a = stoi(num.substr(0, len));
int b = stoi(num.substr(len, len));
int ans = a*b;
if(ans != 0 && ori%ans == 0) printf("Yes\n");
else printf("No\n");
}
return 0;
}