var a,b,t,M,R :integer;
function F(x:integer):integer;
begin
F := 3*(x*x-16)*(x*x-16)+5;
end;
begin
a := -10; b := 20;
M := a; R := F(a);
for t := a to b do begin
if F(t) < R then begin
M := t;
R := F(t);
end;
end;
write(M*R);
end.
|
#include<stdio.h>
int F(int x)
{
return 3*(x*x-16)*(x*x-16)+5;
}
main()
{
int a, b, t, M, R;
a=-10; b=20;
M=a; R=F(a);
for(t=a; t<=b; t++){
if ( F(t) < R) {
M = t;
R = F(t);
}
}
printf("%d",M*R);
}
|
def F(x):
return 3*(x*x - 16) * (x*x - 16) + 5
a = -10
b = 20
M = a
R = F(a)
for t in range(a, b+1):
if F(t) < R:
M = t
R = F(t)
print(M*R) |