80分 第4点手测对但RE

P1618 三连击(升级版)

Iamzzr @ 2021-07-27 10:39:45


#include <bits/stdc++.h>
using namespace std;
int f(int n, int x, int y, int z){
    int a[10]={0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , 0};
    int n1=n, n2=n/x*y, n3=n/x*z;
    while(n1!=0){
        a[n1%10]=1;
        n1/=10;
    }
    while(n2!=0){
        a[n2%10]=1;
        n2/=10;
    }
    while(n3!=0){
        a[n3%10]=1;
        n3/=10;
    }
    bool ok=1;
    for(int i=1; i<=9; i++){
        if(a[i]==0) ok=0;
    }
    if(ok) return 1;
    return 0;
}
int main(){
    int a, b, c;
    cin>>a>>b>>c;
    bool flag=0;
    for(int i=1; i<=9; i++){
        for(int j=1; j<=9; j++){
            for(int k=1; k<=9; k++){
                int s=i*100+j*10+k;
                if(s%a==0 && s/a*c<1000){
                    int t=s;
                    int x=s/a*b;
                    int y=s/a*c;
                    if(f(s, a, b, c)==1){
                        cout<<t<<" "<<x<<" "<<y<<endl;
                        flag=1;
                    }
                }
            }
        }
    }
    if(flag==0) cout<<"No!!!";
    return 0;
} 

by SunLegend @ 2021-07-27 10:41:17

洛谷测评鸡日常抽风中~~~


by 我是坤坤 @ 2021-07-27 10:41:21

@Iamzzr 落谷日爆,等一会在交吧


|