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

12157 - Tariff Plan的更多相关文章

  1. 测试计划(Test Plan)

    测试计划(Test Plan) 版权声明:本文为博主原创文章,未经博主允许不得转载. 测试计划的概念: 测试计划是一个文档,描述了进行测试的测试范围,测试策略和方法,测试资源和进度.是对整个测试活动进 ...

  2. SQL Tuning 基础概述02 - Explain plan的使用

    1.explain plan的使用 SQL> explain plan for delete from t_jingyu; Explained. SQL> select * from ta ...

  3. POJ2175 Evacuation Plan

    Evacuation Plan Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 4617   Accepted: 1218   ...

  4. New Plan!

    很久无写过blogs,荒废得差不多了,在博客园虽开bolg 5年多,但由于自己工作的问题,从开始的热情记录,到冷却冰冻,再到现在重拾起来,有一番感受:从大学刚毕业的制作网页菜鸟,开始接触DIV,CSS ...

  5. 分析oracle的执行计划(explain plan)并对对sql进行优化实践

    基于oracle的应用系统很多性能问题,是由应用系统sql性能低劣引起的,所以,sql的性能优化很重要,分析与优化sql的性能我们一般通过查看该sql的执行计划,本文就如何看懂执行计划,以及如何通过分 ...

  6. 【转】Oracle 执行计划(Explain Plan) 说明

    转自:http://blog.chinaunix.net/uid-21187846-id-3022916.html       如果要分析某条SQL的性能问题,通常我们要先看SQL的执行计划,看看SQ ...

  7. MySQL慢查询Explain Plan分析

    Explain Plan 执行计划,包含了一个SELECT(后续版本支持UPDATE等语句)的执行 主要字段 id 编号,从1开始,执行的时候从大到小,相同编号从上到下依次执行. Select_typ ...

  8. Timusoj 1982. Electrification Plan

    http://acm.timus.ru/problem.aspx?space=1&num=1982 1982. Electrification Plan Time limit: 0.5 sec ...

  9. Oracle SQL explain/execution Plan

    From http://blog.csdn.net/wujiandao/article/details/6621073 1. Four ways to get execution plan(anyti ...

随机推荐

  1. dom03

    鼠标事件: 键盘事件: //通过class获取元素,封装一个通过class获取元素的方法 //IE10以下不支持document.getElementByClass() function getByC ...

  2. WebView Android 调用js且须要获取返回结果

    Android webView调用js方法非常easy, webView.loadUrl("javascrpt:yourFunction()"); 可是此方法没有办法获取返回结果 ...

  3. SQL Server 2012的附件失败,与硬链接的问题

    1.我在系统上做了硬链接,也就是把C盘的某个目录,映射为D盘. 2.把数据库文件mdf和ldf放入D盘.结果,SQL Server的企业管理器,无法从D盘里加载mdf或ldf文件,并且在目录下无法显示 ...

  4. 使用 C# 进行 Outlook 2003 编程

    原文:使用 C# 进行 Outlook 2003 编程 摘要: 本文介绍了 Microsoft Outlook 2003 对象模型介,并探讨了如何使用 C# 编程语言生成 Outlook 识别的应用程 ...

  5. CSS学习笔记:Media Queries

    CSS3提供了Media Queries(媒体查询)的概念,可以利用它查询以下数据: 1.浏览器窗口的宽和高: 2.设备的宽和高: 3.设备的手持方向,横向/竖向: 4.分辨率. @media规则的语 ...

  6. Spring Resource之ResourceLoaderAware接口

    ResourceLoaderAware接口是一个特殊的标记接口,它表示对象需要提供给一个ResourceLoader引用: public interface ResourceLoaderAware { ...

  7. 在Ubuntu 12.04 - 64bit中安装CodeSourcery时提示错误

    安装时提示错误,Your 64-bit Linux host is missing the 32-bit libraries requied to install and use Sourcery C ...

  8. javascript脚本化文档

    1.getElememtById /** * 获取指定id的的元素数组 */ function getElements(/*ids...*/) { var elements = {}; for(var ...

  9. 曲演杂坛--一条DELETE引发的思考

    原文:曲演杂坛--一条DELETE引发的思考 场景介绍: 我们有一张表,专门用来生成自增ID供业务使用,表结构如下: CREATE TABLE TB001 ( ID ,) PRIMARY KEY, D ...

  10. form-validation--表单验证插件

    基于jquery的validationEngine表单验证插件,根据官网提示,该插件支持IE6-8,Chrome浏览器,火狐,Safari,Opera 10,但由于有使用到了css3的阴影和圆角样式, ...