# # Код на ruby 2.2.3p173
max = 0
max_last = 0
min = 1000
min_last = 1000
n = 0
begin
max_last = max
min_last = min
File.open("input.txt", "r") do |infile|
line = infile.gets.strip
p line
n = line.to_i if n == 0
while (line = infile.gets)
p line
number = line.strip.to_i
max = number if max == 0 or number == max + 1
min = number if min == 1000 or number == min - 1
p [min, max]
end
end
end until (max == max_last and max < n) or (min > 0 and min == min_last) or (min == 0 and max == n)
p max + 1 if max == max_last and max < n
p min - 1 if min > 0 and min == min_last
p "error" if min == 0 and max == n
<span><span>Представление информации с помощью некоторого кода</span> - Кодирование
</span>
<em><u>Блок-схема во вложении.</u></em>
var
x,y,c:double;
begin
Write('x='); Read(x);
Write('y='); Read(y);
if x=y then c:=sqr(x+y)+sin(x)
else
if (x-y)=3 then c:=(x+y)*sqr(x+y)+cos(x)
else c:=x+y+tan(x);
Write('c=',c)
end.
<em><u>Тестовое решение:</u></em>
x=0.563
y=-1.514
c=-0.319863379954563