Finally wrote it out, I hope it can help you!
#include<stdio.h>
int main()
{ int a[21][3]; int i,j=0; int n=0,b,k; int t[3]={0}; int zong[ 21]; for(i=11;i<32;i++) { b=i*i; t[0]=b%10; t[1]=b/10%10; t[2]=b/100 ; if((t[0]-t[1])*(t[0]-t[2])*(t[1]-t[2])!=0&&t[0]!=0&&t[1] !=0) //Exclude the case where the ones, ten, and hundreds digits are the same, and the ones and tens are 0 { a[j][0]=t[0]; /*store the three digits in sequence Array a*/ a[j][1]=t[1]; a[j][2]=t[2]; zong[j]=i*i; j++; } } for(i=0;i <j-2;i++) {
for(b=i+1;b<j-1;b++)
{
for(k=b+1;k<j;k++)
{int s[9]={0};
s[a[i][0 ]-1]=1;
s[a[i][1]-1]=1;
s[a[i][2]-1]=1;
s[a[b][0]-1]= 1;
s[a[b][1]-1]=1;
s[a[b][2]-1]=1;
s[a[k][0]-1]=1
; [k][1]-1]=1;
s[a[k][2]-1]=1; //There are nine elements in the array s, all of which are initially 0,
//The elements in the array a are 1~9, and the subscript of the array s is from 0~8, so each element in the array a should be -1*/
for(n=0;n<9;n++)
{ if(s[n]!=1) {
break;
}
}
if(n==9) //judging whether it is row i of array a, all elements in row b and row k are exactly 1~9 { t[0]
=
i;
t[1] =b;
t[2]=k;
break;
}
}
if(n==9)
break;
}
if(n==9)
break;
}
printf("\n%d %d %d",zong[t [0]],zong[t[1]],zong[t[2]]);
return 0;
}