PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GD0000057. Pasha và tiệc trà (Pasha and Tea)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Pasha và tiệc trà (Pasha and Tea)
Pasha and Tea
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
There are cups with capacities , for girls and boys, with a teapot holding milliliters. Every girl gets and every boy gets . Assign cups and pour no more than each cup or teapot allows, maximizing total poured water.
Input
Line 1: . Line 2: cup capacities .
Output
Print the maximum total water with absolute or relative error at most .
Subtasks
- Subtask 1 (20 points): ; ; for every .
- Subtask 2 (30 points): ; ; for every .
- Subtask 3 (50 points): ; ; for every .
Examples
Input
1 5
2 3
Output
4.500000000000
Explanation
Assign the size-2 cup to the girl and the size-3 cup to the boy. The girl can receive at most 1.5, the boy 3, for a total of 4.5; the teapot capacity 5 is not binding.