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 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的更多相关文章
- 测试计划(Test Plan)
测试计划(Test Plan) 版权声明:本文为博主原创文章,未经博主允许不得转载. 测试计划的概念: 测试计划是一个文档,描述了进行测试的测试范围,测试策略和方法,测试资源和进度.是对整个测试活动进 ...
- SQL Tuning 基础概述02 - Explain plan的使用
1.explain plan的使用 SQL> explain plan for delete from t_jingyu; Explained. SQL> select * from ta ...
- POJ2175 Evacuation Plan
Evacuation Plan Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4617 Accepted: 1218 ...
- New Plan!
很久无写过blogs,荒废得差不多了,在博客园虽开bolg 5年多,但由于自己工作的问题,从开始的热情记录,到冷却冰冻,再到现在重拾起来,有一番感受:从大学刚毕业的制作网页菜鸟,开始接触DIV,CSS ...
- 分析oracle的执行计划(explain plan)并对对sql进行优化实践
基于oracle的应用系统很多性能问题,是由应用系统sql性能低劣引起的,所以,sql的性能优化很重要,分析与优化sql的性能我们一般通过查看该sql的执行计划,本文就如何看懂执行计划,以及如何通过分 ...
- 【转】Oracle 执行计划(Explain Plan) 说明
转自:http://blog.chinaunix.net/uid-21187846-id-3022916.html 如果要分析某条SQL的性能问题,通常我们要先看SQL的执行计划,看看SQ ...
- MySQL慢查询Explain Plan分析
Explain Plan 执行计划,包含了一个SELECT(后续版本支持UPDATE等语句)的执行 主要字段 id 编号,从1开始,执行的时候从大到小,相同编号从上到下依次执行. Select_typ ...
- Timusoj 1982. Electrification Plan
http://acm.timus.ru/problem.aspx?space=1&num=1982 1982. Electrification Plan Time limit: 0.5 sec ...
- Oracle SQL explain/execution Plan
From http://blog.csdn.net/wujiandao/article/details/6621073 1. Four ways to get execution plan(anyti ...
随机推荐
- 移动小bug
1. 在三星note2,小米2,页面加载后,页面有黑块. 那么提高被盖住的部分z-index. 2. iphone5 ,ios7.0.4,上文字显示不出 那么就先hide,setTimeout几百毫秒 ...
- Android分析应用程序的构建过程
为了方便Android应用开发要求我们Androidproject编制和包装有了更深入的了解,例如,我们知道这是做什么的每一步,境和工具.输入和输出是什么.等等. 在前文<命令行下Android ...
- Ubuntu Ruby On Rails安装和配置
在这篇文章中ubuntu通过rvm安装ruby和rails.步借鉴了官方网站和网上信息,这里给大家分享. 1. 安装mapapis公钥: gpg --keyserver hkp://keys.gnup ...
- AJAX入门——工作原理
同步和异步交互,了解互动 对于一个样本:一般B/S模式(同步) AJAX技术(异步) * 同步: 提交请求->等待server处理->处理完成返回 ...
- [翻译]初识SQL Server 2005 Reporting Services Part 3
原文:[翻译]初识SQL Server 2005 Reporting Services Part 3 这是关于SSRS文章中四部分的第三部分.Part 1提供了一个创建基本报表的递阶教程.Part 2 ...
- 解决:错误的语法:”XXXX“必须是批处理中仅有的语句
原文:解决:错误的语法:”XXXX“必须是批处理中仅有的语句 SQL Server 数据库提示“错误的语法:”XXXX“必须是批处理中仅有的语句”报错的原因分析 解析:批处理必须以 CREATE ...
- 如何将C#对象转化为JSON字符串
System.Web.Extensions.dll中类JavaScriptSerializer可以帮助我们把C#对象转化为JSON字符串. 有一个Person类 public class Person ...
- Dev的GridView中如何自动生成行号
这里提供一个方法,使用简单,只需将GridView传入,即可自动生成行号 public static void SetRowNumberIndicator(GridView gridView) { g ...
- 使用DateSet下载Excel
这里我们使用Microsoft.Office.Interop.Excel.dll下载Excel,没有引用可点击下载 关键代码,ExcelHelper类 using System; using Syst ...
- 依赖注入和IOC
http://www.bbsmvc.com/archiver/csharp/thread-831-1.html 本来想使用一下Ninject的,然后搜索了很久,都没找到比较详细的关于Ninject的使 ...
