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;
}

最新文章

  1. 对一个二维数组进行升序排列a[0][1]为最小
  2. JQuery实现table分页
  3. Mysql 基于BinaryLog的复制
  4. MySql定位执行效率较低的SQL语句
  5. Ubuntu频率较高的操作
  6. OpenStack Cinder源代码流程简析
  7. Oracle查询表结构的常用语句
  8. (C#)Windows Shell 编程系列3 - 上下文菜单(iContextMenu)(一)右键菜单
  9. How to setup linked servers for SQL Server and Oracle 64 bit client
  10. CentOS 如何使用第三方软件库-EPEL与RPMForge、RPMFusion软件库
  11. Azure Event Hub 技术研究系列3-Event Hub接收事件
  12. GNS3的配置
  13. Java消息系统简单设计与实现
  14. Java注解之 @Target、@Retention简介
  15. 关于Mybaits10种通用的写法
  16. Hibernate(9)_双向n对n
  17. Java中常见的异常处理汇总
  18. unity3d-游戏实战突出重围,第三天 绘制数字
  19. 理解---&gt;Java中的值传递&amp;引用传递
  20. 1.6getId()方法

热门文章

  1. Maven入门笔记
  2. knob.js进度插件
  3. javascript模拟title提示效果
  4. App.config
  5. Knockout简单用法
  6. 一些小bug
  7. 【转】Android 系统菜单与自定义菜单
  8. 动态代理 原理简析(java. 动态编译,动态代理)
  9. RMAN duplicate from active 时遭遇 ORA-17627 ORA-12154
  10. Blend4开发:会飞的小鸟