30
Объяснение:
var a, b, t, M, R: integer; // объявляем переменные
Function F(x: integer):integer; // объявляем функцию F
begin
F := -2*(x+2)*(x-6);
end;
Begin // основная программа
a := -11; b := 11; // a = -11; b = 11
M := a; R:= F(a); // M = a = -11; R = F(a). F(a) = -2*(-11+2)*(-11-6)=(-2)*(-9)*(-17) = 306
t:=a; // t = a = -11
while t < b do // пока t < b
begin
if (F(t)>R) then // если F(t) > R
begin // выполнить такие действия:
M := t; // M = t
R:= F(t); // R = F(t)
end;
t:=t+2; // прибавить к t значение 2
end;
Write(R); // вывести R
End.
inFile = open('input.txt', 'r', encoding='utf8')
outFile = open('output.txt', 'w', encoding='utf8')
score = []
i = 0
nstr = 1
for line in inFile:
if nstr == 1:
k = int(line)
else:
line1 = line.split()
sc3 = int(line1[-1])
sc2 = int(line1[-2])
sc1 = int(line1[-3])
if sc1 >= 40 and sc2 >= 40 and sc3 >= 40:
score.append(sc1 + sc2 + sc3)
i += 1
nstr += 1
inFile.close()
if k >= i:
print(0, file=outFile)
else:
score.sort(reverse=True)
if score[k-1] > score[k]:
print(score[k-1], file=outFile)
else:
ans = ''
for ii in score[k-1::-1]:
if score[k-1] < ii and ans == '':
ans = ii
if ans == '':
ans = 1
print(ans, file=outFile)
outFile.close()
вот программа на языке PASCALABC
uses crt;
const max=20;
var a:array [1..max,1..max] of byte;
n,i,j,k,s,s1,s2,s3:integer;
x:char;
begin
x:=x;
repeat
Writeln('vvedite kol-vo komand N');
Readln(N);
until N in [1..max];
for i:=1 to N do
for j:=1 to N do
A[i,j]:=random(3);
For i:=1 to N do
begin
for j:=1 to N do
if i=j then write(#204:4)
else Write(a[i,j]:4);
writeln;
end;
writeln('íîìåðà êîìàíä, èìåþùèõ áîëüøå ïîáåä íà ÷óæîì ïîëå');
k:=0;
s:=0;
s3:=0;
for i:=1 to n do
begin
for j:=1 to n do
begin
if a[i,j]=2 then s1:=s+1;
if a[j,i]=0 then s2:=s3+1;
s:=s1;
s3:=s2;
end;
end;
if s2>s1 then
begin
writeln('Nomer komandy - ',i,' Kol. pobed = ',s2);
k:=1
end;
if k=0 then writeln('takih komand net');
end.