7个测评点,对了5个(求教)
查看原帖
7个测评点,对了5个(求教)
1367700
YJL999楼主2024/8/22 20:58

不知道,咋错了,求教q_u_q(看着书上做的,结果错了)

#include <bits/stdc++.h>
using namespace std;
int b[20];
long long A,B,C,x,y,z,cnt; 
void go(int x){
	b[x%10]=1;
	b[x/10%10]=1;
	b[x/100]=1;
}
bool check(int x,int y,int 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(){
	cin>>A>>B>>C;
	for(int i=123;i<=987;i++){
		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;
			cnt++;
		} 
	} 
	if(!cnt) cout<<"No!!!";
	return 0;
}

在线等急

2024/8/22 20:58
加载中...