Задача A-Проміле
Березін Дмитро
Var fi,fo:text;
i,j:longint;
n,m:longint;
a:longint;
sum:longint;
Begin
Assign(fi,'promile.in');Reset(fi);
Assign(fo,'promile.out');Rewrite(fo);
sum:=0;
While not seekeof(fi) do Begin
Read(fi,a);
sum:=sum+a;
end;
Write(fo,sum div 1000,',');
sum:=sum mod 1000;
if sum<10 then Writeln(fo,'00',sum) else
if sum<100 then Writeln(fo,'0',sum) else
if sum<1000 then Writeln(fo,sum);
Close(fo);
end.
Задача B-Драгстери
Лавриненко Марк
VAR
n,i,j:Longint;
x,max:extended;
s,ans:String;
q:Char;
p:integer;
Begin
Assign(Input,'dragster.in');Reset(Input);
Assign(Output,'dragster.out');Rewrite(output);
REadLn(n);
max := 0;
For i :=1 to n do
Begin
ReadLn(s);
j:=length(s);
While s[j]<>' ' do dec(j);
val(copy(s,j+1,length(s)-j),x,p);
delete(s,j,length(s)-j+1);
WriteLn(Sqrt(804*x)*3.6:0:3);
If x>max then
Begin
max := x;
ans := s;
End;
End;
WriteLn(ans);
close(input);Close(output);
End.
Задача C-Eight 2 Sixteen
Сорока Дмитро
{$IFDEF NORMAL}
{$H-,I-,OBJECTCHECKS-,Q-,R-,S-}
{$ENDIF NORMAL}
{$IFDEF DEBUG}
{$H-,I+,OBJECTCHECKS-,Q+,R+,S-}
{$ENDIF DEBUG}
{$IFDEF RELEASE}
{$H-,I-,OBJECTCHECKS-,Q-,R-,S-}
{$ENDIF RELEASE}
var a:array[0..7]of string[3];
x:char;
f,ff:text;
s:string[12];
s2:string;
i,n:longint;
j:byte;
b:array[0..15]of char;
c:array[1..1000000]of byte;
function sh(s2:string):byte;
var m:byte;
begin
m:=0;
if s2[4]='1' then m:=1;
if s2[3]='1' then m:=m+2;
if s2[2]='1' then m:=m+4;
if s2[1]='1' then m:=m+8;
sh:=m;
end;
begin
a[0]:='000';a[1]:='001';a[2]:='010';a[3]:='011';a[4]:='100';a[5]:='101';
a[6]:='110';a[7]:='111';
assign(f,'eight.dat');
reset(F);
assign(ff,'sixteen.sol');
rewrite(ff);
i:=2;
read(f,x);
c[1]:=ord(x)-48;
while x<>'.' do
begin
read(f,x);
if x<>'.' then begin c[i]:=ord(x)-48;inc(i);end;
end;
n:=i-1;
b[0]:='0';b[1]:='1';b[2]:='2';b[3]:='3';b[4]:='4';b[5]:='5';b[6]:='6';
b[7]:='7';b[8]:='8';b[9]:='9';b[10]:='A';b[11]:='B';b[12]:='C';b[13]:='D';
b[14]:='E';b[15]:='F';
if (n mod 4)=1 then
begin
write(ff,c[1]);
i:=2;
while i<n do
begin
s:=a[c[i]]+a[c[i+1]]+a[c[i+2]]+a[c[i+3]];
inc(i,4);
s2:=copy(s,1,4);
write(ff,b[sh(s2)]);
s2:=copy(s,5,8);
write(ff,b[sh(s2)]);
s2:=copy(s,9,12);
write(ff,b[sh(s2)]);
end;
end;
if (n mod 4)=2 then
begin
s:='00';
s:=s+a[c[1]]+a[c[2]];
s2:=copy(s,1,4);
if sh(s2)<>0 then write(ff,b[sh(s2)]);
s2:=copy(s,5,8);
write(ff,b[sh(s2)]);
i:=3;
while i<n do
begin
s:=a[c[i]]+a[c[i+1]]+a[c[i+2]]+a[c[i+3]];
inc(i,4);
s2:=copy(s,1,4);
write(ff,b[sh(s2)]);
s2:=copy(s,5,8);
write(ff,b[sh(s2)]);
s2:=copy(s,9,12);
write(ff,b[sh(s2)]);
end;
end;
if (n mod 4)=3 then
begin
s:='000';
s:=s+a[c[1]]+a[c[2]]+a[c[3]];
s2:=copy(s,1,4);
if sh(s2)<>0 then write(ff,b[sh(s2)]);
s2:=copy(s,5,8);
write(ff,b[sh(s2)]);
s2:=copy(s,9,12);
write(ff,b[sh(s2)]);
i:=4;
while i<n do
begin
s:=a[c[i]]+a[c[i+1]]+a[c[i+2]]+a[c[i+3]];
inc(i,4);
s2:=copy(s,1,4);
write(ff,b[sh(s2)]);
s2:=copy(s,5,8);
write(ff,b[sh(s2)]);
s2:=copy(s,9,12);
write(ff,b[sh(s2)]);
end;
end;
if (n mod 4)=0 then
begin
i:=1;
while i<n do
begin
s:=a[c[i]]+a[c[i+1]]+a[c[i+2]]+a[c[i+3]];
inc(i,4);
s2:=copy(s,1,4);
write(ff,b[sh(s2)]);
s2:=copy(s,5,8);
write(ff,b[sh(s2)]);
s2:=copy(s,9,12);
write(ff,b[sh(s2)]);
end;
end;
write(ff,'.');
s:='';
j:=0;
repeat
begin
read(f,x);
s:=s+a[ord(x)-48];
inc(j);
if j=4 then
begin
j:=0;
s2:=copy(s,1,4);
write(ff,b[sh(s2)]);
s2:=copy(s,5,8);
write(ff,b[sh(s2)]);
s2:=copy(s,9,12);
write(ff,b[sh(s2)]);
s:='';
end
end;
until seekeof(F);
if j=1 then write(ff,x);
if j=2 then
begin
s:=s+'00';
s2:=copy(s,1,4);
write(ff,b[sh(s2)]);
s2:=copy(s,5,8);
if sh(s2)<>0 then write(ff,b[sh(s2)]);
end;
if j=3 then
begin
s:=s+'000';
s2:=copy(s,1,4);
write(ff,b[sh(s2)]);
s2:=copy(s,5,8);
write(ff,b[sh(s2)]);
s2:=copy(s,9,12);
if sh(s2)<>0 then write(ff,b[sh(s2)]);
end;
close(F);
close(ff);
end.