Can someone tell me what's wrong with me code. It gives me Exit Code not zero :?
RBgrid
First, input. Should be:
...
Second, what with
(L[A,B]='B')
readln(n,m);
for i:= 1 to n do begin
for j:= 1 to m do read(L[i,j]);
readln;
end;...
...
Second, what with
(L[A,B]='B')
And you should go from 2 to n -1 and 2 to m - 1.
But 1 <= n, m <= 1 000 :?
halil...I have function TF
inside the function the first if is L[A,B] :) :)
Edit:
The last test is wrong result, Can someone tell me where I'm wrong...
halil...I have function TF
inside the function the first if is L[A,B] :) :)
Edit:
The last test is wrong result, Can someone tell me where I'm wrong...
Sorry, I didn't see. I think that variable C should bee longint, not integer. And it will be OK.
Some notice:
- No need If TF(I,J) = True Then ... , enough is If TF(I,J) Then ...
- Becouse 2 <= i <= N-1 and 2 <= j <= M-1, I think that could be:
so, do you realy need function TF? (increase spped).
Some notice:
- No need If TF(I,J) = True Then ... , enough is If TF(I,J) Then ...
- Becouse 2 <= i <= N-1 and 2 <= j <= M-1, I think that could be:
Function TF(a,b : Integer) : Boolean;
Begin
TF:= (L[A,B]='B') and (L[A-1,B]='B') And (L[A+1,B]='B') And (L[A,B-1]='B') And (L[A,B+1]='B');
End;
so, do you realy need function TF? (increase spped).
I change the variable from Integer to LongInt.
About the function..
What if a=1 and b=1..when I try A-1 it will show an error.
Can I define the array from 0..1000 ?
About the function..
What if a=1 and b=1..when I try A-1 it will show an error.
Can I define the array from 0..1000 ?
No need. I used 'array[1..1000,1..1000] Of Char'.
If a=1, no matter. You use
for i:= 2 to n-1 do
for j:= 2 to m-1 do
...
If a=1, no matter. You use
for i:= 2 to n-1 do
for j:= 2 to m-1 do
...
Ahaaam...
I understand :)
Thanks ma friend :)
I understand :)
Thanks ma friend :)
use
as halil said
for(i=2;i<=n-1;i++)
{
for(j=2;j<=m-1;j++)
{
as halil said
nope...with those only one test case is working...I index the elements from 0
make your matrix a little bigger
n i m (1 <= n, m <= 1 000).
his matrix is ok.
I think something else is the problem
his matrix is ok.
I think something else is the problem
THANKS! now the dimensions are 1443*1443 and it works (these are the maximum dimensions)