|
|
вернуться в форумAny ideas about my non-working solution? Послано MadMag 28 мар 2010 00:55 I've got WA on test 1. =( var flag, i, ans:integer; s:string; begin assign(input, 'C:\a.txt');reset(input); ans := 0; flag := 0; while not eof(input) do begin readln(s); i:=1; while i<=length(s) do begin while s[i] in [' ', ',', ';', ':', '-'] do i:=i+1; if (flag = 0)and((ord(s[i])<ord('A')) or (ord(s[i])>ord('Z'))) then ans:= ans + 1; flag:=1; if ((ord(s[i-1])>=ord('A')) and (ord(s[i-1])<=ord('Z'))) and ((ord(s[i])>=ord('A')) and (ord(s[i])<=ord('Z'))) then ans:= ans+1; if s[i] in ['.', '?', '!'] then flag := 0; i:=i + 1; end; end; writeln(ans); end. Edited by author 28.03.2010 00:56 Re: Any ideas about my non-working solution? Послано ile 28 мар 2010 04:31 do not read from "C:/a.txt"!? |
|
|