Parking Fee
Easy · rating 1000 · Math, Implementation
A garage charges rate cents per hour but never more than a daily cap of cap cents. Read three space-separated integers hours rate cap and print the fee charged.
Constraints: 0 ≤ hours, rate, cap ≤ 106
Editorial
Approach
The uncapped charge is hours × rate; the garage bills the smaller of that and the daily cap. One min expresses the whole rule.
hours, rate, cap = map(int, input().split())
print(min(hours * rate, cap))Complexity
Time: O(1). Space: O(1).
Related problems
- FizzBuzz — Easy
- Hex to Decimal — Easy
- Seconds to HH:MM:SS — Easy
- Leap Year — Easy
- RGB to Hex Color — Easy
- Format a Video Length — Medium