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 利用 aapt 解析 apk 得到应用名称 包名 版本号 权限等信息

    在上传各大市场时发现 apk 上传后能自动解析出应用名称.包名.版本号.使用权限等信息,所以就研究了一下 1 直接解压 apk 解析  AndroidManifest.xml 是不行的,因为 apk ...

  2. List 集合转换为String

    开发中会用到把 List<string>  的内容拼接成以逗号分隔的字符串的形式,现总结如下: 方法一: public String listToString(List list, cha ...

  3. 接口处理篇 accept bind connect atan2 htons inet_addr inet_aton inet_ntoa listen ntohl recv send sendto socket

    accept(接受socket连线) 相关函数 socket,bind,listen,connect 表头文件 #include<sys/types.h> #include<sys/ ...

  4. 深入理解Java中的组合和继承

    Java是一个面向对象的语言.每一个学习过Java的人都知道,封装.继承.多态是面向对象的三个特征.每个人在刚刚学习继承的时候都会或多或少的有这样一个印象:继承可以帮助我实现类的复用.所以,很多开发人 ...

  5. go语言基础之数组比较和赋值

    1.go语音基础之数组比较和赋值 示例: package main //必须有个main包 import "fmt" func main() { //支持比较,只支持 == 或 ! ...

  6. centos7 JDK1.8

    安装之前先检查一下系统有没有自带open-jdk rpm -qa |grep java rpm -qa |grep jdk 卸载找出的已安装Java相关rpm文件:rpm -e --nodeps 重新 ...

  7. 【NodeJS】nvm、npm、node安装、使用、淘宝源设置等资料

    NodeJS-安装使用淘宝源 管理 node 版本,选择 nvm 还是 n? - WEB前端 - 伯乐在线 creationix/nvm: Node Version Manager - Simple ...

  8. DateNavigator

    <Border BorderThickness="1,1,1,1" BorderBrush="Black" Grid.Column="1&quo ...

  9. Netdata Linux下性能实时监测工具

    导读 本文将介绍一款非常好用的工具——Netdata,这是一款Linux性能实时监测工具,为一款开源工具,我对其英文文档进行了翻译,水平有限,有翻译错误的地方欢迎大家指出,希望本文对大家有所帮助,谢谢 ...

  10. Qtcreator中常用快捷键总结

    F1        查看帮助F2        跳转到函数定义(和Ctrl+鼠标左键一样的效果)Shift+F2    声明和定义之间切换F4        头文件和源文件之间切换Ctrl+1     ...