证明无解:
int s;
sum(int n){
if (n==1)return s+=5;
if (n==2)return s-=5;
if (n==3)return s*=5;
if (n==4)return s/=5;}
main(){int i,j,k,l,n1,n2,n3,n4;
for(i=1;j<5;i++){s=5;
n1=sum(i);
for(j=1;j<5;j++){if(i==j)break;s=n1;
n2=sum(j);
for(k=1;k<5;k++){if(i==k||k==j)break;s=n2;
n3=sum(k);
for(l=1;l<5;l++){if(i==l||j==l||k==l)break;s=n3;
n4=sum(l);
if(n4==24)printf("%d%d%d%d",i,j,k,l);}}}}}
如果要把其中所有的BREAK语句去掉就是(5*5*5-5)/5
int s;
sum(int n){
if (n==1)return s+=5;
if (n==2)return s-=5;
if (n==3)return s*=5;
if (n==4)return s/=5;}
main(){int i,j,k,l,n1,n2,n3,n4;
for(i=1;j<5;i++){s=5;
n1=sum(i);
for(j=1;j<5;j++){if(i==j)break;s=n1;
n2=sum(j);
for(k=1;k<5;k++){if(i==k||k==j)break;s=n2;
n3=sum(k);
for(l=1;l<5;l++){if(i==l||j==l||k==l)break;s=n3;
n4=sum(l);
if(n4==24)printf("%d%d%d%d",i,j,k,l);}}}}}
如果要把其中所有的BREAK语句去掉就是(5*5*5-5)/5
myQQ::445750010