xzit20200601107 @ 2022-03-03 20:23:14
#include <iostream>
using namespace std;
bool sta[10],temp[10];
double a,b,c;
int ans;
bool judge_tf(double zz)
{
int z = (int) zz;
if (z > 1000) return false;
memcpy(temp, sta, sizeof sta);
while (z)
{
int t = z % 10;
z /= 10;
if (temp[t] || t == 0)
return false;
temp[t] = true;
}
for (int i = 1;i < 10;i ++)
if (!temp[i])
return false;
return true;
}
void judge(int cnt)
{
double x = cnt / a * b;
double y = cnt / a * c;
if (judge_tf(x) && judge_tf(y))
{
printf("%d %lf %lf\n",cnt,x,y);
ans ++;
}
}
void dfs(int u,int cnt)
{
if (u > 2)
{
judge(cnt);
return;
}
for (int i = 1;i < 10;i ++)
if (!sta[i])
{
sta[i] = 1;
dfs(u + 1,cnt * 10 + i);
sta[i] = 0;
}
}
int main()
{
scanf("%lf%lf%lf",&a,&b,&c);
dfs(0, 0);
if (!ans) printf("No!!!");
}