num:array[0..9] of longint=(1234,0,2143,2424,342,1324,131234,2,12314234,123424);
var
n,m,i,j:integer;
map:array[0..11,0..11] of boolean;
f:longint;
x:char;
onek:boolean;
begin
readln(n,m);
fillchar(map,sizeof(map),false);
onek:=false;
for i:=1 to n do
begin
for j:=1 to m do
begin
read(x);
if x=’1’ then
map[i,j]:=true;
end;
readln;
end;
f:=0;
for i:=1 to n do
for j:=1 to m do
if map[i,j] then
begin
if (map[i-1,j]) and (map[i,j+1]) and not(map[i-1,j+1]) then f:=f*10+3;
if (map[i-1,j]) and (map[i,j-1]) and not(map[i-1,j-1]) then f:=f*10+4;
if (map[i+1,j]) and (map[i,j+1]) and not(map[i+1,j+1]) then f:=f*10+1;
if (map[i+1,j]) and (map[i,j-1]) and not(map[i+1,j-1]) then f:=f*10+2;
end;
for i:=0 to 9 do
if f=num[i] then writeln(i);
end.
--------------------------------------------------
状态题目:数字识别
题目编号:206-数字识别 [查看该题]
状态: Accepted
测评机: Xeost[5]
得分: 100分
提交日期: 2008-8-4 3:07:00
有效耗时: 500毫秒
测试结果1: 通过本测试点|有效耗时47:ms
测试结果2: 通过本测试点|有效耗时47:ms
测试结果3: 通过本测试点|有效耗时63:ms
测试结果4: 通过本测试点|有效耗时62:ms
测试结果5: 通过本测试点|有效耗时47:ms
测试结果6: 通过本测试点|有效耗时47:ms
测试结果7: 通过本测试点|有效耗时47:ms
测试结果8: 通过本测试点|有效耗时47:ms
测试结果9: 通过本测试点|有效耗时47:ms
测试结果10: 通过本测试点|有效耗时46:ms