- 数独验证
- 2017-01-18 11:37:52 @
var
n,max,i,j,x:longint;
space,ch:char;
a,b,c:array[1..9,1..9] of boolean;
f:boolean;
begin
readln(n);
for max:=1 to n do
begin
for i:=1 to 9 do
for j:=1 to 9 do
begin
a[i,j]:=false;
b[i,j]:=false;
c[i,j]:=false;
end;
f:=true;
for i:=1 to 9 do
begin
for j:=1 to 9 do
begin
read(ch);
x:=ord(ch)-ord('0');
if j<>9 then
read(space);
if f then
begin
if a[i,x] then
f:=false
else
a[i,x]:=true;
if b[j,x] then
f:=false
else
b[j,x]:=true;
if c[((i+2) div 3-1)*3+(j+2) div 3,x] then
f:=false
else
c[((i+2) div 3-1)*3+(j+2) div 3,x]:=true;
end;
end;
readln;
end;
if f then
writeln('Right')
else
writeln('Wrong');
if max<>n then readln;
end;
end.