提交时间:2025-08-23 11:01:58
运行 ID: 12757
//输出所有形如aabb的4位完全平方数(即前面两位数字相等,后面两位数字也相等) //a:1~9 //b:0~9 #include<bits/stdc++.h> using namespace std; int c() { int a,b,n,m; for(a=1;a<=9;a++) { for(b=0;b<=9;b++) { n=a*1100+b*11; m=floor(sqrt(n)+0.5);//floor(x+0.5)是为了减少误差 if(m*m==n) { printf("%d\n",n); } } } return 0; } int main() { c(); return 0; }