begin var y:=ReadArrReal('2008:',12); var z:=ReadArrReal('2009:',12); var d:=y.Average-z.Average; if d>0 then Writeln('2008 теплее') else if d<0 then Writeln('2009 теплее') else Writeln('Оба года имеют одинаковую среднюю температуру') end.
end_num = 79 for n in 1..5 for i in 0..2**n-1 s = ("000000000000000000000000000000" + i.to_s(2))[-n..-1] start_num = 7 log = start_num.to_s for k in 0..s.size-1
start_num, log = f0(start_num, log) if s[k] == "0" start_num, log = f1(start_num, log) if s[k] == "1" # break if start_num > end_num end # p [start_num, log, s, n] if start_num == end_num then log += " = " + end_num.to_s p log end end end
// Внимание! Если программа не работает, обновите версию!
begin
var g:=ArrRandom(31,0,40); g.Println;
Writeln(g.IndexMax+1)
end.
Пример
38 34 15 11 2 33 12 39 12 0 32 23 7 18 22 31 0 6 19 15 24 37 26 12 7 9 20 25 21 18 20
8
// PascalABC.NET 3.2, сборка 1407 от 18.03.2017
begin
var y:=ReadArrReal('2008:',12);
var z:=ReadArrReal('2009:',12);
var d:=y.Average-z.Average;
if d>0 then Writeln('2008 теплее')
else
if d<0 then Writeln('2009 теплее')
else Writeln('Оба года имеют одинаковую среднюю температуру')
end.
Пример
2008: -12.7 -10.4 -2.3 5.7 12.5 19.6 24.1 22.8 19.9 17.6 8.2 -7.4
2009: -15.2 -9.4 1.6 7.1 13.5 17.1 26.3 21.4 17.5 14.2 10.1 -12.6
2008 теплее
#Ruby22
def f0(number, log)
return [number * number, "(" + log + ")^2 "]
end
def f1(number, log)
return [number - 2, log + " - 2"]
end
end_num = 79
for n in 1..5
for i in 0..2**n-1
s = ("000000000000000000000000000000" + i.to_s(2))[-n..-1]
start_num = 7
log = start_num.to_s
for k in 0..s.size-1
start_num, log = f0(start_num, log) if s[k] == "0"
start_num, log = f1(start_num, log) if s[k] == "1"
# break if start_num > end_num
end
# p [start_num, log, s, n]
if start_num == end_num then
log += " = " + end_num.to_s
p log
end
end
end