100 tenge There are (N) number of coins on table. Some of them are tails and some are heads. How many coins do we need to turn around so that all coins be of the same side? We have total number of coins (N). Next N rows contain the numbers 1 (if a coin is up tail) or 0 lif a coin is up head). Find the minimum number of coins that you must turn.
n,k,i:integer;
begin
for n:=1 to 2 do
begin
writeln('Введите строку ',n,':');
readln(s);
k:=0;
for i:=1 to length(s) do
begin
case s[i] of
'[': k:=k+1;
']': k:=k-1;
end;
end;
if k=0
then writeln('В строке ',s,' количество [ и ] одинаково')
else writeln('В строке ',s,' количество [ и ] не одинаково');
end;
end.
Пример:
Введите строку 1:
c:=a[imax,j]; a[imax,j]:=a[imin,j]; a[imin,j]:=c
В строке c:=a[imax,j]; a[imax,j]:=a[imin,j]; a[imin,j]:=c количество [ и ] одинаково
Введите строку 2:
Просто [ пример ]] со [[ скобками
В строке Просто [ пример ]] со [[ скобками количество [ и ] не одинаково