Problem Statement | |||||||||||||
In Russia, the Value Added Tax is 18% for almost all goods, with the exception of certain food items, which have a Value Added Tax of only 10%. You are given a String product, the name of a product, and an int price, the price of the product before tax. You are also given a String[] food, each element of which is the name of a food product. If the given product is an element in food, it is a food item (and thus subject to 10% tax), and otherwise, it is a non-food item (and thus subject to 18% tax). Return the price of the product after tax has been added. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
| - | The returned value must have an absolute or relative error less than 1e-9. | ||||||||||||
Constraints | |||||||||||||
| - | product will contain between 1 and 50 characters, inclusive. | ||||||||||||
| - | Each character in product will be a lowercase letter ('a'-'z'). | ||||||||||||
| - | price will be between 1 and 1000, inclusive. | ||||||||||||
| - | food will contain between 1 and 50 elements, inclusive. | ||||||||||||
| - | Each element of food will contain between 1 and 50 characters, inclusive. | ||||||||||||
| - | Each character in each element of food will be a lowercase letter ('a'-'z'). | ||||||||||||
| - | All elements of food will be distinct. | ||||||||||||
Examples | |||||||||||||
| 0) | |||||||||||||
| |||||||||||||
| 1) | |||||||||||||
| |||||||||||||
| 2) | |||||||||||||
| |||||||||||||