 2004-06-19 20:40
	    2004-06-19 20:40
  请高手们帮帮忙,谢谢
 2004-06-19 21:38
	    2004-06-19 21:38
   2004-06-19 22:06
	    2004-06-19 22:06
  main()
{int i,j,k,temp,h[10],hu_sir;
long int a,b;
hu_sir=0;
for(i=10;;i++)
{a=i*i*i;
b=i*i*i*i;
if(b>999999||a>9999)break;
for(j=0;j<10;j++)
{if(j<4)
{temp=a%10;
a/=10; }
else
{temp=b%10;
b/=10;}
h[j]=temp;
}
sort(h); //对数组排序,子函数就省略了,自己编吧。
for(k=0;k<10;k++)
{if(h[k]!=k)break;}
if(k=10)
{printf("满足条件的数是:%d",&i); hu_sir=1;}
}
if(hu_sir=0) printf("没有找到满足条件的数!!!");
}
[此贴子已经被作者于2004-06-19 23:46:36编辑过]
 2004-06-19 23:40
	    2004-06-19 23:40
  上面应该没有上机调试吧
#include "stdio.h"
void sort(int a[])
{
    int i;
    for(i=0;i<10;i++)
        for(int j=i;j<10;j++)
        {
            int temp;
            if(a[i]>a[j])
            {
                temp=a[i];
                a[i]=a[j];
                a[j]=temp;
            }
        }
}
void main()
{int i,j,k,temp,h[10],hu_sir;
long int a,b;
hu_sir=0;
for(i=10;;i++)
    {
    a=i*i*i;
b=i*i*i*i;
     if(a>9999||a<1000||b>999999||b<100000)
         continue;
for( j=0;j<10;j++)
{if(j<4)
{temp=a%10;
a/=10; }
else
{temp=b%10;
b/=10;}
h[j]=temp;
}
sort(h); //对数组排序,子函数就省略了,自己编吧。
for(k=0;k<10;k++)
{if(h[k]!=k)break;}
if(k==10)
{printf("满足条件的数是:%d\n",i); hu_sir=1;}
}
if(hu_sir==0) 
printf("没有找到满足条件的数!!!");
}
 
 2006-11-09 16:30
	    2006-11-09 16:30