42A.md (1795B)
1 Source: https://codeforces.com/problemset/problem/42/A 2 3 A. Guilty — to the kitchen! 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 It's a very unfortunate day for Volodya today. He got bad mark in algebra and was therefore forced to do some work in the kitchen, namely to cook borscht (traditional Russian soup). This should also improve his algebra skills. 22 23 According to the borscht recipe it consists of *n* ingredients that have to be mixed in proportion  litres (thus, there should be *a*1 ·*x*, ..., *a**n* ·*x* litres of corresponding ingredients mixed for some non-negative *x*). In the kitchen Volodya found out that he has *b*1, ..., *b**n* litres of these ingredients at his disposal correspondingly. In order to correct his algebra mistakes he ought to cook as much soup as possible in a *V* litres volume pan (which means the amount of soup cooked can be between 0 and *V* litres). What is the volume of borscht Volodya will cook ultimately? 24 25 Input 26 27 The first line of the input contains two space-separated integers *n* and *V* (1 ≤ *n* ≤ 20, 1 ≤ *V* ≤ 10000). The next line contains *n* space-separated integers *a**i* (1 ≤ *a**i* ≤ 100). Finally, the last line contains *n* space-separated integers *b**i* (0 ≤ *b**i* ≤ 100). 28 29 Output 30 31 Your program should output just one real number — the volume of soup that Volodya will cook. Your answer must have a relative or absolute error less than 10- 4. 32 33 Examples 34 35 Input 36 37 ``` 38 1 100 39 1 40 40 41 ``` 42 43 Output 44 45 ``` 46 40.0 47 ``` 48 49 Input 50 51 ``` 52 2 100 53 1 1 54 25 30 55 ``` 56 57 Output 58 59 ``` 60 50.0 61 ``` 62 63 Input 64 65 ``` 66 2 100 67 1 1 68 60 60 69 ``` 70 71 Output 72 73 ``` 74 100.0 75 ```