#include <iostream>
#include <iomanip>
using namespace std;
#define maxn 10
int main()
{
int n,m;
cin >> n >> m ;
float sum=0,sumall=0;
// float a[maxn][2];
// float bc[maxn][2];
// float abc[11];
float a[maxn][2]={{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}};
float bc[maxn][2]={{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}};
float abc[11]={1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000};
// memset(a,0,sizeof(a));
// memset(bc,0,sizeof(bc));
// memset(abc,1000,sizeof(abc));
for(int i=0;i<=n-1;i++)
{
cin >> a[i][0] >> a[i][1];
sumall=sumall+a[i][0];//sumall是不選擇滿減的初始值
if(a[i][1]>0.5)
{
sum = sum+a[i][0]*0.8;
}
else sum = sum + a[i][0];//sum 是選擇滿減的最小可能值
}
for(int j=0;j<=m-1;j++)
{
cin >> bc[j][0] >> bc[j][1];
if (sumall>=bc[j][0])
{
abc[j]=sumall-bc[j][1];
}
else abc[j]=sumall;
}
abc[10]=sum;
float temp = 1000;
for(int t=0;t<=10;t++)
{
if (temp>=abc[t]) temp=abc[t];
}
cout<< fixed << setprecision(2)<<temp<<endl;
//cout<< n << m <<endl;
return 0;
}
美團2018資格賽第一題
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.