|
|
back to boardNot a complicated question+++++++ On what letters there is a mistake? But there are two BIG mistakes in this one! I think on "I" and "G". I am right? why wrong answer 2 program de; const min = ['a'..'z']; max = ['A'..'Z']; pyn = ['.','!','?']; var a:array[1..100] of string; q1,q2:boolean; c:char; i,n,mist,j:integer; u:text; begin { assign(u,'c:\test2.txt'); reset(u);} while not eof do begin inc(n); readln(a[n]); end; for i:=1 to n do begin q1:=true; q2:=false; for j:=1 to length(a[i]) do begin if not (a[i][j] in min+max) then q2:=false; if q1 and (a[i][j] in min) then inc(mist); if q2 and (a[i][j] in max) then inc(mist); q1:=false; if (a[i][j] in max) then q2:=true; if a[i][j] in pyn then begin if j<n then begin inc(j); q1:=true; end else q1:=true; end; end; end; writeln(mist); end. Re: why wrong answer 2 Posted by Kit 29 Apr 2005 15:04 This sentence iz correkt! -It Has,No mista;.Kes et oll. But there are two BIG mistakes in this one. and here is one more. Re: why wrong answer 2 Thanks for the help, but again too. I can something I do not understand Re: why wrong answer 2 program de; const min = ['a'..'z']; max = ['A'..'Z']; pyn = ['.','!','?']; var a:array[1..100] of string; q1,q2:boolean; c:char; i,n,mist,j,z:integer; u:text; begin { assign(u,'c:\test1.txt'); reset(u);} while (not eof) do begin inc(n); readln(a[n]); end; for i:=1 to n do begin z:=1; q2:=false; for j:=1 to length(a[i]) do begin inc(z); if not (a[i][j] in min+max) or (z=1) then q2:=false; if (a[i][j] in min) and (z=2) and ((a[i][j-1]=' ') or (j-1=0)) then inc(mist); if q2 and (a[i][j] in max) then inc(mist); if (a[i][j] in max) and (z<>1) then q2:=true; if a[i][j] in pyn then z:=0; end; end; writeln(mist); end. Re: why wrong answer 2 Posted by Kit 30 Apr 2005 14:53 This sentence iz correkt! -It Has,No mista;.Kes et oll. But there are two bIG mistakes in this one.and here is one more. Your answer is 1, instead of 3. If you wish, I can send to you my code. Edited by author 30.04.2005 14:53 Re: why wrong answer 2 Posted by Dilyan 29 Jun 2005 16:38 I think that you have WA2 because you read with STRING. All the simbols can be on one line and there may be 10 000 simbols. The string's capacity is less than 256. Edited by author 29.06.2005 16:38 Re: why wrong answer 2 To Dilyan: I think that Delphi or Free Pascal is used on this server. In Delphi you can use string - it's long strings (up to 2 GB). In Free Pascal you can use AnsiString. |
|
|