更新时间:2022-08-13 08:40:33
题目链接:http://codeforces.com/contest/557/problem/B
题意:给你n个boy,n个girl ,然后w表示茶壶的最大容量,然后n个茶杯,每个都有不同的容量,要求boy的茶杯里的茶水是girl的两倍,且boy和boy的容量一样,girl和girl的容量一样,问如何倒茶,求最大的倒茶量
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int data[1000005];
int main()
{
int w,n;
cin>>n>>w;
for(int i=0; i<2*n; i++)
cin>>data[i];
sort(data,data+2*n);
double ans=min(1.0*data[0],1.0*data[n]/2);
//cout<<ans<<endl;
ans=3.0*ans*n;
//cout<<ans<<endl;
ans=min(ans,1.0*w);
printf("%.8lf\n",ans);
//cout<<ans<<endl;
return 0;
}
Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2)(A.思维题,B.思维题)
Codeforces Round #326 (Div. 2) B. Pasha and Phone C. Duff and Weight Lifting
接上一篇 580 B. Kefa and Company [ Codeforces Round #321 (Div. 2)]
Codeforces Round #327 (Div. 2) B. Rebranding C. Median Smoothing
codeforces 578 B. Finding Team Member( Codeforces Round #320 (Div. 2) )
Codeforces 584 B. Kolya and Tanya (Codeforces Round #324 (Div. 2))