{1}
const
s:string = 'IVXLCDM';
var
x,i,l,k:integer;
begin
read(x); {x < 4000}
l := 1000;
i := 4;
for i := 4 downto 1 do
begin
k := x div l mod 10;
if k = 9 then
write(s[i*2-1],s[i*2+1])
else
if k = 4 then
write(s[i*2-1],s[i*2])
else
begin
if k >= 5 then
begin
write(s[i*2]);
k := k - 5
end;
for k := k downto 1 do
write(s[i*2-1])
end;
l := l div 10
end
end.
{2}
const
eps = 1e-10;
stp = 500;
var
a: real;
l,r,m: real;
extreme: real;
function f(x:real):real;
begin
f := a*x - exp(-x)
end;
begin
read(a);
if a = 0 then
writeln('No solutions')
else
if a > 0 then
begin
l := 0;
r := stp*2;
while f(r) <= 0 do<br> begin
l := l + stp;
r := r + stp
end;
while r - l > eps do
begin
m := (l + r)/2;
if f(m) > 0 then
r := m
else
l := m
end;
m := (l + r) / 2;
writeln('Solution: ',m:0:5);
writeln('e^-x = ',exp(-m):0:5);
writeln('ax = ',a*m:0:5)
end
else
begin
extreme := ln(-1/a);
if f(extreme) < 0 then
writeln('No solutions')
else
if f(extreme) = 0 then
writeln('Solution: ',extreme)
else
begin
{writeln('Extreme: ',extreme);}
l := extreme;
r := 0;
while r - l > eps do
begin
m := (l + r)/2;
if f(m) < 0 then
r := m
else
l := m
end;
m := (l + r) / 2;
writeln('Solution 1: ',m:0:5);
writeln('e^-x = ',exp(-m):0:5);
writeln('ax = ',a*m:0:5);
writeln;
r := extreme;
l := r - stp*2;
while f(l) > 0 do
begin
l := l - stp;
r := r - stp
end;
while r - l > eps do
begin
m := (l + r)/2;
if f(m) > 0 then
r := m
else
l := m
end;
m := (l + r) / 2;
writeln('Solution 2: ',m:0:5);
writeln('e^-x = ',exp(-m):0:5);
writeln('ax = ',a*m:0:5)
end
end
end.
{3}
var
c: array [1..12] of 0..7;
x,i,k: integer;
begin
read(x);
k := x;
i := 0;
repeat
i := i + 1;
c[i] := k mod 8;
k := k div 8
until k = 0;
for i := i downto 1 do
write(c[i])
end.