没有运行结果

P1618 三连击(升级版)

zhangshibo678 @ 2022-07-20 14:22:06

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int sum[111];
int main(){
int a,b,c;
int j,t;
cin>>a>>b>>c;
for(int i=100;i<=333;i++){
int w=i;   int n=j=b*i;   int m= t=c*i;
        while(w!=0){
        int x=w%10;
        w=w/10;
        sum[x]=x;
        }
        while(n!=0){
        int y=n%10;
        n=n/10;
        sum[y]=y;
        }
        while(m!=0){
        int z=m%10;
        m=m/10;
        sum[z]=z;
        }
        for(int i=1;i<=9;i++)
        {
            if(sum[i]!=i)  break;
        }
            if(i==10&&sum[i-1]==9){
            cout<<i<<" "<<j<<" "<<t<<endl;
        }
}
        return 0;
    }

by xiexie1234 @ 2022-07-20 17:42:50

少输出no


by xiexie1234 @ 2022-07-21 07:50:15

把我的代码粘上去你看一下


#include<cstdio>
#include<cstring>
using namespace std;
bool x[10];
int main(){
    int a,a1,a2;
    int b,b1,b2;
    int i1,i2,i3;
    int A,B,C,y;
    y=0;
    scanf("%d %d %d",&A,&B,&C);
    for(int i=1;;i++){
        a=1;
        b=1;
        memset(x,0,sizeof(x));
        int flag=1;
        i1=i*A;
        i3=i1;
        a=i*B;
        a1=a;
        b=i*C;
        b1=b;
        if(i1<100) continue;
        if(b>999) break;
        while(a1>0){
            a2=a1%10;
            a1=a1/10;
            x[a2]=!x[a2];
        }
        while(b1>0){
            b2=b1%10;
            b1=b1/10;
            x[b2]=!x[b2];
        }
        while(i1>0){
            i2=i1%10;
            i1=i1/10;
            x[i2]=!x[i2];
        }
        for(int j=1;j<=9;++j){
            if(x[j]!=1){
                flag=0;
                break;
            }
        }
        if(flag==1) {
            y=1;
            printf("%d %d %d\n",i3,a,b);
        }
    }
    if(y==0){
        printf("No!!!");
    }
    return 0;
}

|