Security bouncer
The security bouncer at a bar needs to keep track of the age. It’s a European bar, so the entrance is allowed for everyone 18 and older.
For each visitor below 18, the program should tell them
You are not allowed to get in
. And for others, the program should welcome them telling Welcome to the best bar! Enjoy!
.For each allowed visitor, the program will also get a number - how much they spent that day in the bar. The program should print the total revenue of the bar that night.
The first line of the input contains a single number
n
- the number of visitors in the line. The next two lines contain the age of the visitor, and their spending if they are allowed to the bar.For each customer, the program should print the appropriate message and how much the visitors spent in total at the very end.
Input | Output |
3
19
400
7
20
200 | Welcome to the best bar! Enjoy!
You are not allowed to get in
Welcome to the best bar! Enjoy!
Total: 600 |
Explanation:
- First visitor - 19 years old spends 400 euros
- Second visitor - 7 years old is not allowed
- Third visitor - 20 years old spends 200 euros
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB