time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups,…
题 题意 总共有 w 克蛋糕,2n 个盘子,第 i 个盘子容量为 ai ,n 个女孩和 n 个男孩,男孩得到的是女孩得到的蛋糕的两倍,求他们得到蛋糕的最大值. 分析 把盘子从小到大排序,然后 女生得到的蛋糕总量是 n*min(最小的盘子,第n+1小的盘子/2,w/(3n)). 答案就是女生得到的蛋糕的3倍. 代码 #include<cstdio> #include<algorithm> using namespace std; int n,a[1000005]; double w,…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Innokentiy likes tea very much and today he wants to drink exactly n cups of tea. He would be happy to drink more but he had exactly n tea bags,…