# UVa 12157 - Tariff Plan
from functools import reduce
def sum(x1, x2): return x1 + x2
number_of_test_cases = int(input())
for test_case in range(1, number_of_test_cases+1):
number_of_calls = int(input())
call_durations = list(map(int, input().split()))
cost_for_Miles_plan = reduce(sum, map(lambda x: x//30+1, call_durations)) * 10
cost_for_Juice_plan = reduce(sum, map(lambda x: x//60+1, call_durations)) * 15
cheapest_cost = min(cost_for_Miles_plan, cost_for_Juice_plan)
if cost_for_Miles_plan < cost_for_Juice_plan:
cheapest_plan = 'Mile'
elif cost_for_Miles_plan > cost_for_Juice_plan:
cheapest_plan = 'Juice'
else:
cheapest_plan = 'Mile Juice'
print(f'Case {test_case}: {cheapest_plan} {cheapest_cost}' )
Tuesday, September 10, 2019
UVa 12157 - Tariff Plan
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment