Code
program slova;
var str:string[80];
i,n,asl:integer;
s:set of char;
begin
s:=['0','1','2','3','4','5','6','7','8','9',' ','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
asl:=0;
read(str);i:=1;
while ((str[i] in s) and (i<=80)) do
begin
if (str[i]='a') then inc(asl);
while ((str[i]<>' ') and (str[i]in s)) do inc(i);
if (str[i]=' ') then if (str[i+1]<>' ') then inc(i) else begin writeln ('ERROR! Two spaces!');asl:=0;break;end else if not (str[i]=str[i+1]) then writeln('ERROR!Invalid input data!');
end;
writeln('kol-vo slov nachinaushihsya s bukvi "a"=',asl);
end.
первая
Code
program goals;
var n,i,count:integer;
begin
write ('Vvedite summu golov:');read(n);
i:=1;
while (n>0) do
begin
n:=n-i;
count:=count+1;
i:=i+1
end;
if (n=0) then writeln('V matche bilo zabito ',count,' golov') else writeln('Vvedennoe chislo nepravilno.');
end.
вторая. вроде так)