|
|
back to boardWhat's wrong in my code? Posted by Evgeny 16 Mar 2003 02:23 Var a,b,c: array[1..3000] of byte; i,j,k,n,m: Longint; begin readln(m,n); for i := 1 to n do begin for j := 1 to m do begin read(a[j]); end; for j := 1 to m do begin c[j] := a[j] + b[j]; end; for j := 1 to m-1 do begin if ((c[j] = 1) and (c[j+1] = 2)) or ((c[j] = 2) and (c[j+1] = 1)) then begin writeln('No'); halt; end; end; b := a; readln; end; writeln('Yes'); end. Re: What's wrong in my code? Posted by Evgeny 16 Mar 2003 05:26 > Var > a,b,c: array[1..3000] of byte; > i,j,k,n,m: Longint; > > begin > readln(m,n); > for i := 1 to n do begin > for j := 1 to m do begin > read(a[j]); > end; > for j := 1 to m do begin > c[j] := a[j] + b[j]; > end; > for j := 1 to m-1 do begin > if ((c[j] = 1) and (c[j+1] = 2)) or ((c[j] = 2) and (c[j+1] = > 1)) then begin > writeln('No'); > halt; > end; > end; > b := a; > readln; > end; > writeln('Yes'); > end. > I have changed readln or read and got AC. |
|
|