#include<bits/stdc++.h> using namespace std; int main(){ string s,s1,s2; for(int i=1000;i<10000;i++){ s1.clear();//循环开头记得清空字符串 s2.clear(); s = to_string(i);//把 int 转换成 string s1.push_back(s[0]); s1.push_back(s[1]); s2.push_back(s[2]); s2.push_back(s[3]); if((stoi(s1)+stoi(s2))*(stoi(s1)+stoi(s2))==i){//stoi()把 string 转换成 int cout << i << " "; } } return 0; }
0.0分
0 人评分