h(x)=f(x)g(x)

ans=min(h(x))

# 代码

#include<cstdio>
#include<algorithm>
#include<cmath>
#define MAXN 300
using namespace std;
#define EPS 1e-9
#define INF 1e27
struct node{
double k,b;
bool operator<(const node &x)const{
if(fabs(k-x.k)<EPS)
return b>x.b;
return k<x.k;
}
bool operator==(const node &x)const{
return fabs(k-x.k)<EPS;
}
}a[MAXN+10],b[MAXN+10];
struct point{
double k,b,x,y;
point(){
};
point(node a,double xx,double yy){
x=xx,y=yy,k=a.k,b=a.b;
}
}p[MAXN+10];
int n,x[MAXN+10],y[MAXN+10],na,np;
double ans=INF;
char c;
bool f=0;
while(c=getchar(),c!=EOF){
if(x=='-')
f=1;
if(c>='0'&&c<='9'){
x=c-'0';
while(c=getchar(),c>='0'&&c<='9')
x=x*10+c-'0';
ungetc(c,stdin);
if(f)
x=-x;
return;
}
}
}
int i;
for(i=1;i<=n;i++)
for(i=1;i<=n;i++)
for(i=1;i<n;i++){
b[i].k=1.0*(y[i]-y[i+1])/(x[i]-x[i+1]);
b[i].b=y[i]-x[i]*b[i].k;
a[i]=b[i];
}
sort(a+1,a+n);
na=unique(a+1,a+n)-a-1;
}
void ints_halfplane(){
int i,j,ti;
double tx,x;
for(i=1;i<na;){
x=INF;
for(j=i+1;j<=na;j++){
tx=(a[j].b-a[i].b)/(a[i].k-a[j].k);
if(tx<=x)
ti=j,x=tx;
}
p[++np]=point(a[i],x,x*a[i].k+a[i].b);
i=ti;
}
p[++np]=point(a[na],INF,0);
}
void solve(){
int i,j;
ints_halfplane();
for(i=j=1;i<=np&&j<=n;){
if(p[i].x<x[j]){
ans=min(p[i].y-b[j-1].k*p[i].x-b[j-1].b,ans);
i++;
}
else{
ans=min(p[i].k*x[j]+p[i].b-y[j],ans);
j++;
}
}
}
int main()
{
}