#include<stdio.h>
int main(){
int i,x,y=0,c,b,num,count=-1,j,a[4],n[100],m[100];
for(i=1000;i<10000;i++)
{
b=i;count=-1;
while(b!=0)
{
count++;
a[count]=b%10;
b=b/10;
}
for(j=0;j<4;j++)
{
if(a[j]==4||a[j]==7||a[0]==0)
count=0;
if(a[j]==6)
a[j]=9;
else if(a[j]==9)
a[j]=6;
}
if(count==0)
continue;
num=a[0]*1000+a[1]*100+a[2]*10+a[3];
x=num-i;
if(x<900&&x>800)
{
n[y]=i;
m[y]=x;
y++;
}
if(x<-200&&x>-300)
{
n[y]=i;
m[y]=x;
y++;
}
}
for(i=0;i<y;i++)
for(j=i;j<y;j++)
{
if(m[i]+m[j]==558){
printf("%d %d ",n[i],m[i]);
printf("%d %d\n\n",n[j],m[j]);}
}
}
最终结果是9088