蒟蒻RE求助
查看原帖
蒟蒻RE求助
759660
AKioi0101楼主2023/12/30 11:57
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;

int cnt[10];

void chai(int x)
{
	while (x > 0)
	{
		cnt[x % 10]++;
		x /= 10;
	}
}

bool check(int x, int y, int z)
{
	if (y > 999 || z > 999) return false;
	memset(cnt, 0, sizeof(cnt));
	chai(x);
	chai(y);
	chai(z);
	for (int i = 1;i <= 9;i++)
	{
		if (cnt[i] != 1) return false;
	}
	return true;
}

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    bool flag = true;
    for (int x = 123; x <= 987; x++)
    {
        if (x * b % a != 0 || x * c % a != 0) continue;
        int y = x * b / a;
        int z = x * c / a;
        if (check(x, y, z))
        {
        	cout << x << ' ' << y << ' ' << z << endl;
        	flag = false;
        }
    }
    if (flag == true) cout << "No!!!" << endl;
    return 0;
}

怎么RE了

2023/12/30 11:57
加载中...