Uses GraphABC; var tnk:array of Point; begin Window.Title := 'Танк атакует'; var y := 200; Brush.Color := clGreen; LockDrawing; tnk:=new Point[4]; for var x := 70 to 500 do begin Window.Clear(clWhite); Rectangle(x,y,x+100,y+50); Rectangle(x-25,y+50,x+125,y+75); tnk[0].X:=x-45; tnk[0].Y:=y+75; tnk[1].X:=x-30; tnk[1].Y:=y+120; tnk[2].X:=x+100; tnk[2].Y:=y+120; tnk[3].X:=x+145; tnk[3].Y:=y+75; Rectangle(x+100,y+10,x+225,y+25); FillPolygon(tnk); Redraw; Sleep(3); end; end.
Var f:text; s:string; i,slo,ks:integer; k:real; begin assign(f,'text.in'); reset(f); while not Eof(f) do read(f,s); close(f); slo:=0; ks:=0; for i:=1 to length(s) do if s[i] in t then inc(slo) else begin; k:=k+slo; inc(ks); slo:=0; end; if s[length(s)] in t then begin; inc(ks); k:=k+slo; end; k:=k/ks; assign(f,'text.out'); rewrite(f); write(f,k); close(f); end.
Пример ввода(text.in): SIMPLE text Пример вывода(text.out): 5
var tnk:array of Point;
begin
Window.Title := 'Танк атакует';
var y := 200;
Brush.Color := clGreen;
LockDrawing;
tnk:=new Point[4];
for var x := 70 to 500 do begin
Window.Clear(clWhite);
Rectangle(x,y,x+100,y+50);
Rectangle(x-25,y+50,x+125,y+75);
tnk[0].X:=x-45;
tnk[0].Y:=y+75;
tnk[1].X:=x-30;
tnk[1].Y:=y+120;
tnk[2].X:=x+100;
tnk[2].Y:=y+120;
tnk[3].X:=x+145;
tnk[3].Y:=y+75;
Rectangle(x+100,y+10,x+225,y+25);
FillPolygon(tnk);
Redraw;
Sleep(3);
end;
end.
type
ty=set of char;
Const
t:ty=['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','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'];
Var
f:text;
s:string;
i,slo,ks:integer;
k:real;
begin
assign(f,'text.in');
reset(f);
while not Eof(f) do read(f,s);
close(f);
slo:=0;
ks:=0;
for i:=1 to length(s) do
if s[i] in t then inc(slo) else
begin;
k:=k+slo;
inc(ks);
slo:=0;
end;
if s[length(s)] in t then
begin;
inc(ks);
k:=k+slo;
end;
k:=k/ks;
assign(f,'text.out');
rewrite(f);
write(f,k);
close(f);
end.
Пример ввода(text.in):
SIMPLE text
Пример вывода(text.out):
5