请完善下面的程序,将1~9个数字填入3*3的九宫格中,每一行的三个数字组成一个三位数。要使第二行的三位数是第三行的2倍,第一行的三位数是第三行的3倍,且每个格子里的数字都不能重复。比如第三行是327,则第二行是654,第一行是981,满足上述要求。
现在要求输出所有的填充方案,以每种方案中的第一行组成的三位数升序输出。
输出格式:每一种方案输出共三行,每行为一个三位数,每种方案输出后都要输出一个空行。
最后一行一个数字,表示方案的总数。
#include<bits/stdc++.h>
using namespace std;
#define n 9
int a[10], b[10], t1, t2, t3, c;
void f(int s)
{
int i;
if(____(1)______)
{
t1=a[1]*100+a[2]*10+a[3];
t2=a[4]*100+a[5]*10+a[6];
t3=a[7]*100+a[8]*10+a[9];
if(_____(2)_______)
{
cout<<t1<<endl;
cout<<t2<<endl;
cout<<t3<<endl;
cout<<endl;
c++;
}
return;
}
for(i=1;i<=n;i++)
{
if(b[i]==0)
{
______(3)______
b[i]=1;
_____(4)_______
_____(5)_______
}
}
}
int main( )
{
f(1);
cout<<c<<endl;
return 0;
}