wanzzhehe @ 2016-10-29 13:21:34
#include<iostream>
#include<cstdio>
using namespace std;
int search(int);
int chushu();
int pd(int,int,int);
int print();
bool d[10],flag;
int a,b,c,e[3],f[10];
int main()
{
cin>>a>>b>>c;
search(1);
if(!flag)cout<<"No!!!\n";
return 0;
}
int search(int n)
{
for(int i=1;i<=9;i++)
{
if(!d[i])
{
f[n]=i;
d[i]=1;
if(n==9)chushu();
else search(n+1);
d[i]=0;
}
}
}
int chushu()
{
e[0]=f[1]+f[2]*10+f[3]*100;
e[1]=f[4]+f[5]*10+f[6]*100;
e[2]=f[7]+f[8]*10+f[9]*100;
pd(e[0],e[1],e[2]);
}
int pd(int x,int y,int z)
{
if(x*b==y*a&&b*z==c*y&&x*c==z*a)
{
print();flag=1;
}
}
int print()
{
for(int i=0;i<=2;i++)
cout<<e[i]<<" ";
cout<<"\n";
}
by wanzzhehe @ 2016-10-29 13:22:45
谁有1#的测试数据啊
by NicodeX @ 2016-10-29 15:13:19
interesting
by NicodeX @ 2016-10-29 15:15:52
你难道不知道luogu有个东东叫做“数据下载”吗……(滑稽)
by NicodeX @ 2016-10-29 15:20:50
数据:
1 2 3
192 384 576
219 438 657
273 546 819
327 654 981
貌似就是题目的样例啊……