Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 252    Accepted Submission(s): 144

Problem Description
  Yesterday your dear cousin Coach Pang gave you a new 100MB hard disk drive (HDD) as a gift because you will get married next year.   But you turned on your computer and the operating system (OS) told you the HDD is about 95MB. The 5MB of space is missing. It is known that the HDD manufacturers have a different capacity measurement. The manufacturers think 1 “kilo” is 1000 but the OS thinks that is 1024. There are several descriptions of the size of an HDD. They are byte, kilobyte, megabyte, gigabyte, terabyte, petabyte, exabyte, zetabyte and yottabyte. Each one equals a “kilo” of the previous one. For example 1 gigabyte is 1 “kilo” megabytes.   Now you know the size of a hard disk represented by manufacturers and you want to calculate the percentage of the “missing part”.
 
Input
  The first line contains an integer T, which indicates the number of test cases.   For each test case, there is one line contains a string in format “number[unit]” where number is a positive integer within [1, 1000] and unit is the description of size which could be “B”, “KB”, “MB”, “GB”, “TB”, “PB”, “EB”, “ZB”, “YB” in short respectively.
 
Output
  For each test case, output one line “Case #x: y”, where x is the case number (starting from 1) and y is the percentage of the “missing part”. The answer should be rounded to two digits after the decimal point.
 
Sample Input
2 100[MB] 1[B]
 
Sample Output
Case #1: 4.63%
Case #2: 0.00%

Hint

 
Source
简单的题:
 #include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
char str[];
int t,i,cnt=;
double a;
scanf("%d",&t);
while(t--)
{
scanf("%s",str);
for(i=;str[i]!='[';i++);
switch(str[++i])
{
case'B': a=0.00; break;
case'K': a=2.34; break;
case'M': a=4.63; break;
case'G': a=6.87; break;
case'T': a=9.05; break;
case'P': a=11.18; break;
case'E': a=13.26; break;
case'Z': a=15.30; break;
case'Y': a=17.28; break;
}
printf("Case #%d: %.2lf%%\n",cnt++,a);
}
return ;
}
 

HDUOJ----(4788)Hard Disk Drive的更多相关文章

  1. HDU - 4788 Hard Disk Drive (成都邀请赛H 水题)

    HDU - 4788 Hard Disk Drive Time Limit:1000MS   Memory Limit:32768KB   64bit IO Format:%I64d & %I ...

  2. HDU 4788 Hard Disk Drive (2013成都H,水题)

    Hard Disk Drive Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  3. HDU 4788 Hard Disk Drive (2013成都H,水题) 进位换算

    #include <stdio.h> #include <algorithm> #include <string.h> #include<cmath> ...

  4. hdu 4788 Hard Disk Drive (水题)

    题意: Input The first line contains an integer T, which indicates the number of test cases. For each t ...

  5. [Ubuntu] Error: The disk drive for /media/sda2 is not ready yet or not present

    After updated Ubuntu, and reboot, I got these error The disk drive for /media/sda2 is not ready yet ...

  6. go语言 os.Rename() cannot move the file to a different disk drive 怎么办

    时值我小病在家休养生息,喜欢跳广场舞的外公来寻求我的帮助,他们跳广场舞是将存有歌曲的U盘插到音响上面,而音响大部分都是只能显示歌曲的索引index,不能直接显示歌曲名,所以为了方便他们会在U盘里面对歌 ...

  7. Hard Disk Drive(MBR)

    这里讲的主要是网上所谓的老式磁盘,它是由一个个盘片组成的,我们先从个盘片结构讲起.如图1所示,图中的一圈圈灰色同心圆为一条条磁道,从圆心向外画直线,可以将磁道划分为若干个弧段,每个磁道上一个弧段被称之 ...

  8. HDU4788_Hard Disk Drive

    水题. 但是我写挫了一个地方,Wa了三发.好吧,不能忍了. 还有,本屌不知道如何用printf输出%,哪位学过C++的大仙知道这是什么情况?  告诉我一声啊. #include <iostrea ...

  9. The 2013 ACMICPC Asia Regional Chengdu

    还有19天出发北京站,今年北京站的出题方是上交,去年他们出的成都现场的赛题,首先复盘一下. 去年的成都是我经历的第一次现场赛,也是近距离第一次见到了CLJ的真人,最后也是被虐惨了,那时候是声闻大神带着 ...

随机推荐

  1. Android之开源中国客户端源码分析(一)

    程序启动第一个界面类: net.oschina.app.AppStart功能描述:一张图片代码细节描述:一个透明度的动画效果,效果动画完成后自动启动新的Activity(Main) 基本BaseAct ...

  2. [Swift] Swift3.0--GCD

    reference to : http://www.jianshu.com/p/4c983388dca6 估计现在好多人在为这一块头疼,所以先来点干货. //最常用模板 //全局队列异步执行 Disp ...

  3. #line 的作用是改变当前行数和文件名称

    #line 的作用是改变当前行数和文件名称,它们是在编译程序中预先定义的标识符命令的基本形式如下:   #line number["filename"]其中[]内的文件名可以省略. ...

  4. 【BZOJ】【2502】清理雪道

    网络流/上下界网络流 带下界的最小可行流…… 我SB了,跑网络流的时候是得从虚拟源0往出跑……而不是S…… Orz Hzwer /*********************************** ...

  5. Hadoop目录

    1. 通过java读取HDFS的数据 (转) 2. FLume监控文件夹,将数据发送给Kafka以及HDFS的配置文件详解 3. 开启hadoop和Hbase集群的lzo压缩功能(转) 4. Hado ...

  6. [13] 弧面(Arc)图形的生成算法

    顶点数据的生成 bool YfBuildArcVertices ( Yreal radius, Yreal degree, Yreal height, Yuint slices, Yuint stac ...

  7. Tomcat安装笔记(on Mac)

    1. 官网 http://tomcat.apache.org/ 下载apache包,我下的8.5 注意要下core包的tgz版本,我开始下了full doc. 2. 拷贝解压到 /Library, 然 ...

  8. Tengine zabbix 监控

    Tengine 配置 在http 段下新增以下配置 req_status_zone server_stat "$host" 3M; server { listen 9008; lo ...

  9. 访问者模式讨论篇:java的动态绑定与双分派

    java的动态绑定 所谓的动态绑定就是指程执行期间(而不是在编译期间)判断所引用对象的实际类型,根据其实际的类型调用其相应的方法.java继承体系中的覆盖就是动态绑定的,看一下如下的代码: class ...

  10. Linux,Windows和UNIX的进程调度的分析

    摘要 : 本文以Linux ,Unix ,Windows 操作系统为例,分析其进程调度策略,以期对进程调度过程有更深层次的认识     关键词 : 进程调度 优先级 时间片轮转 实时进程 分时技术   ...