12157 - Tariff Plan


Ampang Communications & Mobile (ACM) provides telecom services for various types of users. Since the people of Ampang are quite talkative, they are always seeking for packages that are best suited for them. To have an edge over their competitors, ACM provides various packages. Two of the most popular packages are:

  • Mile
  • Juice

 

Mile charges every 30 seconds at a rate of 10 cents. That means if you talk for 29 seconds or less, you will be charged with 10cents. If you talk for 30 to 59 seconds, you will be charged with20 cents and so on.

 

Juice charges every 60 seconds at a rate of 15 cents. That means if you talk for 59 seconds or less, you will be charged with15 cents. Similarly, if you talk for 60 seconds to 119 seconds, you will be charged with 30 cents and so on.

 

Given a list of call durations, can you determine the package that is cheaper?

 

Input

The first line of input is an integer T(T<50) that denotes the total number of test cases. Each case starts with a line containing an integer N(0<N<20). The next line gives a list of N call durations (In second). Each call duration is an integer in the range [1, 2000]. Consecutive integers are separated by a single space character.

 

Output

For each case, output the case number first. Then output the name of the cheaper package followed by the corresponding cost in cents. If both package gives the same total cost, then output both the names (Mile preceding Juice) followed by the cost. Look at the output for sample input for details.

 

Sample Input                            Output for Sample Input

3

2

61 10

3

40 40 40

2

60 65

Case 1: Mile 40

Case 2: Juice 45

Case 3: Mile Juice 60


#include<iostream>
using namespace std;
int main()
{
	int t,n,a,count=1;
	cin>>t;
	while(t--)
	{
		cin>>n;
		int x=0,y=0;
		for(int i=0;i<n;i++)
			{
				cin>>a;
				x+=(a/30+1)*10;
				y+=(a/60+1)*15;
		}
		cout<<"Case "<<count++<<": ";
		if(x<y) cout<<"Mile "<<x<<endl;
		else if(x>y) cout<<"Juice "<<y<<endl;
		else cout<<"Mile Juice "<<x<<endl;
	}
	return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值