#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int judge(int number);
void main()
{
int n,a;
static int count;
int Return_Boolean;
scanf("%d",&n);
if(n>999&&n<100)
{
printf("重新输入:");
scanf("%d",&n);
}
for(a=101;a<=n;a++)
{
Return_Boolean=judge(a);
if(Return_Boolean==1)
{
printf("%d\t",a);
count++;
if(count%5==0)//每五个数为一行输出来//
printf("\n");
}
}
}
int judge(int number)
{
double i=sqrt((double)number);
int loop=0;
char str_number[3];
itoa(number,str_number,10);//将整数转换为字符串来处理,用到函数itoa//
{
int i,j;
for(i=0;i<3;i++)
for(j=i+1;j<3;j++)
{
if(str_number[i]==str_number[j])
loop=1;
}
if((str_number[0]==str_number[1])&&(str_number[1]==str_number[2]))//只有两个数字是一样的,排除三个数字一样的情况//
loop=0;
}
if(((int)i*i==number)&&(loop==1))
return 1;
else
return 0;
}