80分了,求大佬最后指点

P1618 三连击(升级版)

xzit20190507121 @ 2019-11-02 21:50:45

int main(){
    int A,B,C;
    scanf("%d%d%d",&A,&B,&C);
    int a[10],num1,num2,num3,t=0;
    for(num1=123;num1<1000/C;num1++){
        num2=num1*B/A;
        num3=num1*C/A;
        a[0]=num1/100;
        a[1]=num1/10%10;
        a[2]=num1%10;
        a[3]=num2/100;
        a[4]=num2/10%10;
        a[5]=num2%10;
        a[6]=num3/100;
        a[7]=num3/10%10;
        a[8]=num3%10;
        if(a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7]+a[8]==1+2+3+4+5+6+7+8+9&&
        a[0]*a[1]*a[2]*a[3]*a[4]*a[5]*a[6]*a[7]*a[8]==1*2*3*4*5*6*7*8*9){
            printf("%d %d %d\n",num1,num2,num3);
            t=num1;
        }
    }
    if(t==0){
        printf("No!!!");
    }
    return 0;
}

by 0nullptr @ 2019-11-02 22:11:54

@xzit20190507121 给的数字可能是192 384 576这样的


|