#7wa,求条

P1618 三连击(升级版)

liangcha_crush_ly @ 2024-08-31 00:11:43

#include<iostream>

using namespace std;
int a,b,c,f=0;
bool check(int a,int b,int c){
    bool v[10]={};
    for(int i=1;i<=3;i++){
        v[a%10]=1;
        v[b%10]=1;
        v[c%10]=1;
        a/=10,b/=10,c/=10;
    }
    for(int i=1;i<=9;i++)if(!v[i])return 0;
    return 1;
}
signed main(){
    cin>>a>>b>>c;
    if(a==0||b==0||c==0){
        cout<<"No!!!";
        return 0;
    }
    for(int i=100;i<=1000/c;i++){
        int a1=a*i;
        int b1=b*i;
        int c1=c*i;
        if(a1>999||b1>999||c1>999)break;
        if(check(a1,b1,c1)){
            f=1;
            cout<<a1<<" "<<b1<<" "<<c1<<"\n";
        }
    }
    if(!f)cout<<"No!!!";
    return 0;
}

by liangcha_crush_ly @ 2024-08-31 00:28:40

ac,此贴结,wa的原因暂时没发现


|