Movie
SRM 98 · 2002-06-14 · by axchma
Problem Statement
At a particular movie theatre, movie tickets cost $4.50. This means that some customers pay with an amount that includes the $0.50, while others pay with whole dollar amounts and must be given $0.50 in change. If too many people pay with whole dollar amounts, eventually the theatre will run out of quarters to return to people as change.
Your task is to write a class Movie, with a method angryCust, which takes a
Constraints
- line contains between 0 and 50 characters inclusive
- each character in line is either 'e' or 'f'
"eeeeeeeeeeeeeeeeeeeeeeeeeeeee" Returns: -1
"efefff" Returns: 6
"fefeeffffffffffffffff" Returns: 8
"eeeeefffffff" Returns: 12
"eeeeefffffeeeeefffffeeeeefffffeeeeefffffeeeeefffff" Returns: -1
"ff" Returns: 2
The cashier has change only for the first customer, so customer 2, who needs change, doesn't get any.
"eeeeeeeeeeeeeeeeeeeeeeeeeeeee" Returns: -1
Nobody needs change.
Submissions are judged against all 31 archived test cases, of which 7 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class Movie with a public method int angryCust(string line) · 31 test cases · 2 s / 256 MB per case