80分WA求助
查看原帖
80分WA求助
529247
Br00k5xx楼主2021/8/2 14:36
#include <set>
#include <cstdio>
#include <vector>
using std::vector;
using std::set;
int a[9];
set<int> s;
vector<int> f, l, t;
int main()
{
    double a, b, c, x, y, z;
    int d, o, p;
    scanf("%lf %lf %lf", &a, &b, &c);
    for (int i = 1; i < 10; i++)
    {
        for (int j = 1; j < 10; j++)
        {
            if (j == i) continue;
            for (int k = 1; k < 10; k++)
            {
                if (k == i || k == j) continue;
                x = i * 100 + j * 10 + k;
                y = x / a * b;
                if (((int)y) != y || y > 987) continue;
                z = y / b * c;
                if (((int)z) != z || z > 987) continue;
                d = x, o = y, p = z;
                s.clear();
                s.insert(i);
                s.insert(j);
                s.insert(k);
                s.insert(o / 100);
                s.insert(o / 10 % 10);
                s.insert(o % 10);
                s.insert(p / 100);
                s.insert(p / 10 % 10);
                s.insert(p % 10);
                if (s.size() == 9)
                {
                    f.push_back(d);
                    l.push_back(o);
                    t.push_back(p);
                }
            }
        }
    }
    if (f.empty())
    {
        printf("No!!!");
        return 0;
    }
    for (int i = 0; i < f.size(); i++)
    {
        printf("%d %d %d\n", f[i], l[i], t[i]);
    }
}
2021/8/2 14:36
加载中...