Задача A-Проміле
Var fi,fo:Text;
Sum,a,t:longint;
Begin
Assign(fi,'promile.in'); Reset(fi);
Assign(fo,'promile.out'); Rewrite(fo);
While not seekeof(fi) do Begin Read(fi,a); Sum:=Sum+a End;
Write(fo,Sum div 1000,','); t:=Sum mod 1000;
If t<100 Then Write(fo,0); If t<10 Then Write(fo,0); Writeln(fo,t);
Close(fi); Close(fo)
End.
Задача B-Драгстери
Var fi,fo: Text;
Max,a: extended;
i,N,t:Longint;
er: integer;
s,m: string;
Begin
Assign(fo,'dragster.out'); Rewrite(fo); Max:=0;
Assign(fi,'dragster.in'); Reset(fi); Readln(fi,N);
For i:=1 to N do Begin Readln(fi,s);
t:=pos('"',copy(s,2,length(s)-1))+1;
val(copy(s,t+2,length(S)-t-1),a,er);
If a>max Then Begin m:=copy(s,1,t); Max:=a End;
Writeln(fo,sqrt(804*a)*3.6:0:3);
End; Writeln(fo,m);
Close(fi); Close(fo)
End.
Задача C-Eight 2 Sixteen
Const h:array[0..15] of char = '0123456789ABCDEF';
Var fi,fo: Text;
c: array[-2..1000003] of shortint;
r: array[-2..1000003] of char;
i,t,p: longint;
ch: char;
Procedure convert(na,kil,d,po:longint);
Var S,j:longint;
Begin For j:=1 to kil do Begin S:=c[na]+(c[na-1] shl 3)+(c[na-2] shl 6)+(c[na-3] shl 9);
r[po-2]:=h[S shr 8]; r[po-1]:=h[(S and 255) shr 4]; r[po]:=h[S and 15];
na:=na+d+d+d+d; po:=po+d+d+d End;
End;
Begin
Assign(fi,'eight.dat'); Reset(fi); i:=0;
Assign(fo,'sixteen.sol'); Rewrite(fo);
While not seekeof(fi) do Begin inc(i); read(fi,ch);
c[i]:=byte(ch)-48; if c[i]=-2 Then t:=i End;
p:=(t*3-4) div 4+2;
convert(t-1,(t-2) div 4+1,-1,p-1); r[p]:='.';
convert(t+4,(i-t-1) div 4+1,1,p+3);
For i:=p+((i-t-1)*3 div 4) to p+((i-t-1)*3 div 4+4) do
If Byte(r[i])>48 Then p:=i;
If (r[1]='0') and (r[2]<>'.') Then t:=2 else t:=1;
for i:=t to p do Write(fo,r[i]); Writeln(fo);
Close(fi); Close(fo)
End.