"Topic link" click here~~
"The main idea" gives you n boy,n a girl, then w represents the maximum capacity of the teapot, and then n Cups, each with a different capacity, requiring boy's cup of tea is twice times the girl, and boy and boy capacity, girl and girl capacity, like, ask how to pour tea, Maximizing the total amount of tea
"Problem-solving ideas" This problem is very simple, the first read the question did not read, thought that each cup of tea is full, and then a think is not to take the biggest calculation. A turn, direct WA, and then carefully read the question, found that each cup of tea can choose to pour (pit ~ AH), then since the boy and Boy,girl and girl of tea, then as long as the first to find the smallest capacity and then compare it, because the boy's cup of tea is girl twice times, So the girl is the smallest.
Code:
#include <bits/stdc++.h>using namespace Std;const int n=3*1e5+10;double num[n];int main () { int n,w; while (scanf ("%d%d", &n,&w)!=eof) {for (int i=1; i<=2*n; ++i) scanf ("%lf", &num[i]); Sort (num+1,num+1+2*n); Double Res=min (NUM[1],NUM[N+1]/2);///////Select the minimum res=res*3*n after the play sequence; Res=min (res,1.0*w); printf ("%.6f\n", res); } return 0;}
Res=res*3*n=res*n+res*2*n;
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Codeforces Round #311 (Div. 2) b. Pasha and Tea