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 ...
随机推荐
- TRS_WCM(拓尔思信息技术有限公司)内容协作平台平台置标经验攻略
TRS_WCM置标过程中经验积累 版本V4.0-2014.6.24-穿越者7号 目录 1.嵌套模板置标 1 2.栏目名称超链接置标 1 3.列表循环输出文档标题包含超链接 1 4.取既定栏目下第一篇文 ...
- Object-C面向对象之实现类
Object-C面向对象之实现类 一般涉及到面向对象都会C#,Java都不可避免的涉及到类,C#中类的后缀名是.cs,Java中是.java,Object-C中一般用两个文件描述一个类,后缀名为.h为 ...
- GDI+ 摘要: 保存图像文件
要保存图像文件,必须先获得图像的编码格式信息.可是GDI+没有直接提供这个函数:GetEncoderClsid(const WCHAR* format, CLSID* pClsid) 因此须要我们自己 ...
- PHP+MYSQL分页原理
1.SQL语句中的limit用法 2.学习分页的一种公式 3.parse_url()解析URL函数 parse_url() 是将URL解析成有固定键值的数组的函数 4.$_SERVER["R ...
- CentOS 5.8安装SugarCRM 6.5版本
环境:CentOS 5.8,安装了Asterisk 1.8 升级php到5.2SugarCRM 6.5: Minimum PHP version required is 5.2.0. You are ...
- 《C语言 学生成绩管理系统》
/* (盯着先拔头筹程序) * 该计划的版权声明和版本号 * Copyright (c) 2011, 烟台大学计算机学院学生的学校 * All rights reserved. * 文件名: 学生成绩 ...
- SpringMVC实现注解式权限验证
SpringMVC学习系列(9) 之 实现注解式权限验证 对大部分系统来说都需要权限管理来决定不同用户可以看到哪些内容,那么如何在Spring MVC中实现权限验证呢?当然我们可以继续使用servle ...
- Web API实现POST报文的构造与推送
ASP.NET Web API实现POST报文的构造与推送 毕设和OAuth协议相关,而要理解OAuth协议就必须理解HTTP GET/POST方法.因此研究了一下如何使用Web API或MVC构 ...
- MVC应用程序请求密码的功能1
MVC应用程序请求密码的功能(一) 经过一系列的练习,实现了会员注册<MVC会员注册>http://www.cnblogs.com/insus/p/3439599.html,登录<M ...
- SQL2008R2 无法读取此系统上以前注册的服务器的列表--网上方法不可行
C:\Users\<username>\AppData\Local\Temp,然后创建两个命名为1和2的文件夹