var
a:array[1..120,1..10]of integer;
x,i,j,z,y:integer;
begin
readln(i);readln(j);
for x:=1 to i do
for y:=1 to j do
begin
if y=j then readln(a[x,y]) else
read(a[x,y]);
end;
for x:=i+1 downto 1 do
for y:=1 to j do
begin
if (x mod 2=0) then break else
begin
if (y=1) then
begin
if (a[x+2,y]=1) and (a[x+2,y+1]=1) and (a[x+1,y]=1) then
a[x,y]:=a[x,y]+1;
end;
if (y=j) then
begin
if (a[x+2,y-1]=1) and (a[x+2,y]=1) and (a[x+1,y]=1) then
a[x,y]:=a[x,y]+1;
end;
if (a[x+2,y-1]=1) and (a[x+2,y+1]=1) and (a[x+2,y]=1) then
a[x,y]:=a[x,y]+1;
end;
for y:=1 to j do;
if (i mod 2=0) then write(a[i+1,y]) else write(a[i,y]);
end;
end.
读入数据不管 主要是中间怎么错了 我一个一个打数据可是出来是3个0 ...
主要思想动态规划
把车看成走日字 别的车不动..
应该是这样,把两排数据合并成一排,如果直走,那么两排有几个1就撞几次。斜走呢,要看离终点更近那一排有没有1,有1则撞,没1则过。