//PascalABC.NET версия 3.2, сборка 1389 //Если программа не запускается, то обновите версию uses System.Linq; begin writeln('III'); var a := ReadArrInteger('Документы', ReadInteger('n=')).ToList; writeln;
while a.Any() do begin write(a[0], ' '); a.RemoveAt(0); if not a.Any then break;
write(a.Last, ' '); a.RemoveAt(a.Count - 1); if not a.Any then break;
var n := 0; if a.Count > 1 then n := a.Count div 2 - 1; write(a[n], ' '); a.RemoveAt(n); end; end.
uinput = input('трёхзначное натуральное число: ') # 123
numbers = [int(i) for i in uinput] # [1, 2, 3]
highest = max(numbers) # 3
lowest = min(numbers) # 1
numbers.pop(numbers.index(highest)) # [1, 2, 3] = [1, 2]
numbers.pop(numbers.index(lowest)) # [1, 2] = [2]
middle = numbers[0] # 2
# print(highest, lowest, middle) 3 1 2
num1 = str(highest) + str(middle) # '32'
if lowest == 0:
~~~~if middle == 0:
~~~~~~~~num2 = str(highest) + str(lowest)
~~~~else:
~~~~~~~~num2 = str(middle) + str(lowest)
else:
~~~~num2 = str(lowest) + str(middle) # '12'
print(num1 + ' - ' + num2 + ' = ' + str(int(num1) - int(num2))) # 32 - 12 = 20
//Если программа не запускается, то обновите версию
uses System.Linq;
begin
writeln('III');
var a := ReadArrInteger('Документы', ReadInteger('n=')).ToList;
writeln;
while a.Any() do
begin
write(a[0], ' ');
a.RemoveAt(0);
if not a.Any then break;
write(a.Last, ' ');
a.RemoveAt(a.Count - 1);
if not a.Any then break;
var n := 0;
if a.Count > 1 then n := a.Count div 2 - 1;
write(a[n], ' ');
a.RemoveAt(n);
end;
end.