var
a:array [1..20] of real;
i,b,count:integer;
p:real;
begin
a[1]:=0.3; a[11]:=36;
a[2]:=5; a[12]:=13;
a[3]:=68; a[13]:=15;
a[4]:=-3; a[14]:=28;
a[5]:=32; a[15]:=-0.7;
a[6]:=-80; a[16]:=-36;
a[7]:=-9; a[17]:=-0.3;
a[8]:=-26; a[18]:=8;
a[9]:=-9; a[19]:=15;
a[10]:=40; a[20]:=-7;
b:=5; count:=0; p:=1;
for i:=1 to 20 do
write(a[i],' ');
if ) then
inc(count);
p:=p*a[i];
end;
writeln;
writeln('count: ',count,' Pr: ',p);
end.
N=int(input())
a=[]
sum = 0
f = 0
c = 0
for i in range(N):
l = int(input())
sum = sum + l
a.append(l)
if N == 1:
print(1)
else:
ans = []
for i in range(N-1, 0, -1):
if a[i] > a[i-1]:
if sum > a[-1] or (sum > a[i+1] and f == 1):
for k in range(c+1):
ans.append(1)
f = 1
ans.append(0)
elif a[i] == a[i-1]:
c += 1
sum=sum-a[i]
ans = ans[::-1]
print(0)
for i in range(c):
for i in ans:
print(i)
Объяснение:
с тебя 500 рублей у меня сегодня др
var
a:array [1..20] of real;
i,b,count:integer;
p:real;
begin
a[1]:=0.3; a[11]:=36;
a[2]:=5; a[12]:=13;
a[3]:=68; a[13]:=15;
a[4]:=-3; a[14]:=28;
a[5]:=32; a[15]:=-0.7;
a[6]:=-80; a[16]:=-36;
a[7]:=-9; a[17]:=-0.3;
a[8]:=-26; a[18]:=8;
a[9]:=-9; a[19]:=15;
a[10]:=40; a[20]:=-7;
b:=5; count:=0; p:=1;
for i:=1 to 20 do
begin
write(a[i],' ');
if ) then
begin
inc(count);
p:=p*a[i];
end;
end;
writeln;
writeln('count: ',count,' Pr: ',p);
end.
N=int(input())
a=[]
sum = 0
f = 0
c = 0
for i in range(N):
l = int(input())
sum = sum + l
a.append(l)
if N == 1:
print(1)
else:
ans = []
for i in range(N-1, 0, -1):
if a[i] > a[i-1]:
if sum > a[-1] or (sum > a[i+1] and f == 1):
for k in range(c+1):
ans.append(1)
c = 0
f = 1
else:
ans.append(0)
f = 0
elif a[i] == a[i-1]:
c += 1
else:
ans.append(0)
f = 0
sum=sum-a[i]
ans = ans[::-1]
print(0)
for i in range(c):
print(0)
for i in ans:
print(i)
Объяснение:
с тебя 500 рублей у меня сегодня др