CF799C Fountains
题目描述
Arkady想要建 $2$ 座喷泉,他有 $n$ 座可以选的喷泉,$c$ 个金币和 $d$个钻石, 每座喷泉可且仅可用金币或钻石一种货币来买,金币和钻石也不能以任何方式转化。现在要使两座喷泉美丽值总和最大且Arkady能买得起,求出最大美丽值。
输入格式
第一行 $3$ 个数,$n$ ,$c$,$d$ $(2
输出格式
输出一行一个正整数,即两座喷泉的最大美丽值总和。
说明/提示
In the first example Arkady should build the second fountain with beauty $ 4 $ , which costs $ 3 $ coins. The first fountain he can't build because he don't have enough coins. Also Arkady should build the third fountain with beauty $ 5 $ which costs $ 6 $ diamonds. Thus the total beauty of built fountains is $ 9 $ .
In the second example there are two fountains, but Arkady can't build both of them, because he needs $ 5 $ coins for the first fountain, and Arkady has only $ 4 $ coins.