smurf_h @ 2024-03-08 11:21:28
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int num[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
int a, b, c;
int cal(int l, int r)
{
int res = 0;
for (int i = l; i <= r; i++)
{
res = res * 10 + num[i];
}
return res;
}
int main()
{
std::cin >> a >> b >> c;
int cnt = 0;
while (std::next_permutation(num, num + 9))
{
for (int i = 0; i < 9; i++)
{
for (int j = i + 1; j < 9; j++)
{
int x = cal(0, i);
int y = cal(i + 1, j);
int z = cal(j + 1, 8);
if (b * c * x == a * c * y && a * c * y == a * b * z)
{
std::cout << x << ' ' << y << ' ' << z << std:: endl;
cnt++;
}
}
}
}
if (cnt == 0) std::cout << "N0!!!";
return 0;
}
by fanjiayu666 @ 2024-03-08 12:58:35
是TLE吧
@smurf_h
by smurf_h @ 2024-03-08 14:38:08
@fanjiayu666 测试结果没有TLE,WA了五个,#12457
by fanjiayu666 @ 2024-03-08 17:43:37
两种方法:
1.下数据,下过它(我是这么干的)
2.改改
by fanjiayu666 @ 2024-03-08 17:46:45
当然,下数据吗只能在你50pts以上并实在不会,才下。