N = int(input())
X = [''] * N
for a in range(N):
X[a] = int(input())
a = 0
c, b, e, f = 0, 0, 0, N + 1
g, h = 0, 0
while a < N - 2:
a += 1
e += 1
b, c = X[a], b
if c < b:
while a < N - 1:
d = X[a]
if d < b:
if e < f:
g, h = a - e + 1, a + 1
f = e
break
elif d == b:
continue
else:
e = 0
if g == 0 and h == 0:
print(0)
else: print(g, h)
Объяснение:
ответ: Pascal последняя версия, задача только на хз почему 1 неправильно
program C1;
var
N, x: int64;
begin
read(x);
read(N);
if (N > 0) and (N <= abs(x)) then
x := x + n
else if (N > 0) and (N >= abs(x)) then
x := x + n + 1;
if (N < 0) and (abs(N) <= abs(x)) then
x := x - abs(N)
else
if (N < 0) and (abs(N) >= abs(x)) then
x := x - abs(N) - 1;
if x <> 0 then
writeln(x)
else begin
if N > x then
x := x +1
x := x -1;
writeln(x);
end;
end.
N = int(input())
X = [''] * N
for a in range(N):
X[a] = int(input())
a = 0
c, b, e, f = 0, 0, 0, N + 1
g, h = 0, 0
while a < N - 2:
a += 1
e += 1
b, c = X[a], b
if c < b:
while a < N - 1:
a += 1
e += 1
d = X[a]
if d < b:
if e < f:
g, h = a - e + 1, a + 1
f = e
break
elif d == b:
continue
else:
break
e = 0
if g == 0 and h == 0:
print(0)
else: print(g, h)
Объяснение:
ответ: Pascal последняя версия, задача только на хз почему 1 неправильно
program C1;
var
N, x: int64;
begin
read(x);
read(N);
if (N > 0) and (N <= abs(x)) then
x := x + n
else if (N > 0) and (N >= abs(x)) then
x := x + n + 1;
if (N < 0) and (abs(N) <= abs(x)) then
x := x - abs(N)
else
if (N < 0) and (abs(N) >= abs(x)) then
x := x - abs(N) - 1;
if x <> 0 then
writeln(x)
else begin
if N > x then
x := x +1
else
x := x -1;
writeln(x);
end;
end.
Объяснение: