有一个RE是为什么

P1618 三连击(升级版)

tmcz202070101 @ 2024-04-12 19:24:49

#include<iostream>
#include<cstdio>
#include<math.h>
#include<cstring>
#include<stdio.h>
#include<algorithm>
int b[10];
using namespace std;
void go(long long x){
    b[x%10]=1;
    b[x/10%10]=1;
    b[x/100]=1;
}
bool check(long long x,long long y,long long z){
    memset(b,0,sizeof(b));
    if(y>999||z>999) return 0;
    go(x),go(y),go(z);
    for(int i =1; i <= 9;i++)
        if(!b[i]) return 0;
    return 1;
}
int main()
{
    long long A,B,C,x,y,z,sum=0;
    cin>>A>>B>>C;
    for(x=123;x<=987;x++){
        if(x*B%A || x*C%A) continue;
        y=x*B/A,z=x*C/A;
        if(check(x,y,z)){
            cout<<x<<" "<<y<<" "<<z<<endl;
            sum++;
        }
    }
    if(sum==0)   cout<<"No!!!";
}

by jqQt0220 @ 2024-04-12 19:29:11

A,B,C$ 可能为 $0

by tmcz202070101 @ 2024-04-12 19:32:24

@jqQt0220 好的好的,AC了,谢谢


|