var a, b, t, N, Z :integer;
Function F(x: integer):integer;
begin
F := -2*(5-x)*(2-x)+4;
end;
BEGIN
a := 2; b := 9;
Z := F(a);
N := 0;
for t := a to b do begin
if (F(t) <Z) then
N := N+1;
Z:=F(t);
end;
write(N);
END.
|
#include<stdio.h>
int F(int x)
{
return(-2*(5-x)*(2-x)+4);
}
int main(void)
{
int a, b, t, Z, N;
a = 2; b = 9;
Z = F(a);
N = 0;
for (t=a; t<= b; t++)
{
if (F(t) <Z) N++;
Z=F(t);
}
printf(″%d″, N);
}
|
def F(x):
return -2*(5 - x) * (2 - x) + 4
a = 2
b = 9
Z = a
N = 0
for t in range (a, b+1):
if F(t) < Z:
N += 1
Z = F(t)
print (N) |