蒟蒻求助 手测样例ac 实际2 3wa
查看原帖
蒟蒻求助 手测样例ac 实际2 3wa
529347
小火龙不摆烂楼主2021/9/4 19:34
#include<bits/stdc++.h>
using namespace std;
int b[10];
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()
{
	long long A,B,C,x,y,z,cnt=0;
	cin>>A>>B>>C;
	for(int 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;
			cnt++;
		}
	}
	if(!cnt) 
	cout<<"NO!!!";
	return 0;
}
2021/9/4 19:34
加载中...