var
A, B, K, R : longint;
begin
readln(A, B);
if (A mod 2 = 1) and (B mod 2 = 1) then
writeln('-1');
if (A mod 2 = 0) and (B mod 2 = 0) and
((A div 2 <> B) or (B div 2 <> A)) then
((A div 2 = B) or (B div 2 = A)) then
if A > B then
writeln(B, '0')
else
writeln('0', A);
if (A mod 2 = 1) and (B mod 2 = A) then begin
A := A-1;
B := B-2;
if (A div 2 = B) or (B div 2 = A) then
end;
if (B mod 2 = 1) and (A mod 2 = B) then begin
B := B-1;
A := A-2;
if (B div 2 = A) or (A div 2 = B) then
if B > A then
writeln('0', A)
end.
На Всё что могу.
ответ: Это python
Объяснение:
N = int(input())
if N == 1:
exit(0)
bacteria = [0] * N
for i in range(0, N):
bacteria[i] = int(input())
prefix_sum = [bacteria[0]] * N
for i in range(1, N):
prefix_sum[i] = prefix_sum[i - 1] + bacteria[i]
ans = [0] * N
if bacteria[N-1] > bacteria[0]:
ans[N - 1] = 1
for i in reversed(range(2, N)):
if ans[i] == 1:
prev = i - 1
if prefix_sum[prev] > bacteria[i] and bacteria[0] < bacteria[prev]:
ans[prev] = 1
for i in range(N):
print(ans[i])
var
A, B, K, R : longint;
begin
readln(A, B);
if (A mod 2 = 1) and (B mod 2 = 1) then
writeln('-1');
if (A mod 2 = 0) and (B mod 2 = 0) and
((A div 2 <> B) or (B div 2 <> A)) then
writeln('-1');
if (A mod 2 = 0) and (B mod 2 = 0) and
((A div 2 = B) or (B div 2 = A)) then
if A > B then
writeln(B, '0')
else
writeln('0', A);
if (A mod 2 = 1) and (B mod 2 = A) then begin
A := A-1;
B := B-2;
if (A div 2 = B) or (B div 2 = A) then
if A > B then
writeln(B, '0')
else
writeln('0', A);
end;
if (B mod 2 = 1) and (A mod 2 = B) then begin
B := B-1;
A := A-2;
if (B div 2 = A) or (A div 2 = B) then
if B > A then
writeln(B, '0')
else
writeln('0', A)
end;
end.
На Всё что могу.
ответ: Это python
Объяснение:
N = int(input())
if N == 1:
exit(0)
bacteria = [0] * N
for i in range(0, N):
bacteria[i] = int(input())
prefix_sum = [bacteria[0]] * N
for i in range(1, N):
prefix_sum[i] = prefix_sum[i - 1] + bacteria[i]
ans = [0] * N
if bacteria[N-1] > bacteria[0]:
ans[N - 1] = 1
for i in reversed(range(2, N)):
if ans[i] == 1:
prev = i - 1
if prefix_sum[prev] > bacteria[i] and bacteria[0] < bacteria[prev]:
ans[prev] = 1
for i in range(N):
print(ans[i])