|
|
вернуться в форумWHY!? Crash (ACCESS_VIOLATION) Послано Akshin 2 апр 2005 20:40 First of all I got WA at test 4# then I understood that whis error was beacuse I red data by wrong way: I used " while not eoln " then I changed this to "while not eof" and this test passed on my comp. When submited my program IGot Crash on test 3#! Plz help me! Here is my program: var s:array[1..40] of string; n,i,j,k:integer; b:boolean; procedure readdata; begin n:=0; while not eof do begin inc(n); readln(s[n]); end; end; begin readdata; b:=true; for i:=1 to n do for j:=1 to length(s[i]) do if (b) and ((s[i][j] in ['A'..'Z']) or (s[i][j] in ['a'..'z'])) then begin b:=false; if s[i][j] in ['a'..'z'] then inc(k); end else if (s[i][j]='.') or (s[i][j]='!') or (s[i][j]='?') then begin b:=true; end else if (s[i][j] in ['A'..'Z']) then begin if (j>1) and ((s[i][j-1] in ['A'..'Z']) or (s[i][j-1] in ['a'..'z'])) then inc(k); end; writeln(k); end. Re: WHY!? Crash (ACCESS_VIOLATION) Послано wwwwww 2 апр 2005 21:06 I don't know why, but if you write 's:array[1..100] of string;' You will have AC. Re: WHY!? Crash (ACCESS_VIOLATION) And I know why: If a test contains more than 40 lines... your solution will fail, isn't it? |
|
|