- 数独验证
- 2017-04-30 15:30:50 @
#include<stdio.h>
int main()
{
int n;
int b[10][10];
int u=1;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
for(int h=1;h<=9;h++)
{
for(int l=1;l<=9;l++)
{
scanf("%d",&b[h][l]);
}
}
}
for(int i=1;i<=n;i++)
{
for(int ph=1;ph<=9;ph++)
{
if(b[ph][1] != b[ph][2] != b[ph][3] != b[ph][4] != b[ph][5] != b[ph][6] != b[ph][7] != b[ph][8] != b[ph][9]);
else
{
u=0;
}
}
for(int po=1;po<=9;po+=3)
{
if(b[po][1] != b[po][2] != b[po][3] != b[po+1][1] != b[po+1][2] != b[po+1][3] != b[po+2][1] != b[po+2][2] != b[po+2][3]);
if(b[po][4] != b[po][5] != b[po][6] != b[po+1][4] != b[po+1][5] != b[po+1][6] != b[po+2][4] != b[po+2][5] != b[po+2][6]);
if(b[po][7] != b[po][8] != b[po][9] != b[po+1][7] != b[po+1][8] != b[po+1][9] != b[po+2][7] != b[po+2][8] != b[po+2][9]);
else
{
u=0;
}
}
if(u==0)
printf("Wrong\n");
if(u==1)
printf("Right\n");
}
}