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

#include<stdio.h>
#include<string.h>
int change(char *s){
if(!strcmp(s,"[B]")) return ;
if(!strcmp(s,"[KB]")) return ;
if(!strcmp(s,"[MB]")) return ;
if(!strcmp(s,"[GB]")) return ;
if(!strcmp(s,"[TB]")) return ;
if(!strcmp(s,"[PB]")) return ;
if(!strcmp(s,"[EB]")) return ;
if(!strcmp(s,"[ZB]")) return ;
if(!strcmp(s,"[YB]")) return ;
}
int main(){
int t;
scanf("%d",&t);
int s,count=;
char str[];
while(t--){
scanf("%d%s",&s,str);
int c=change(str);
double p=;
while(c--)
p*=1000.0/1024.0;
p=-p;
printf("Case #%d: %.2f%%\n",++count,p*);//printf("%%");输出%
}
return ;
}

水题~~~~HDU 4788的更多相关文章

  1. 又是一道水题 hdu背包

    Problem Description 电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额.如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负) ...

  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 (成都邀请赛H 水题)

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

  4. hdu 2393:Higher Math(计算几何,水题)

    Higher Math Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  5. HDU 5832 A water problem(某水题)

    p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...

  6. HDU 2096 小明A+B --- 水题

    HDU 2096 /* HDU 2096 小明A+B --- 水题 */ #include <cstdio> int main() { #ifdef _LOCAL freopen(&quo ...

  7. [HDU 2602]Bone Collector ( 0-1背包水题 )

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2602 水题啊水题 还给我WA了好多次 因为我在j<w[i]的时候状态没有下传.. #includ ...

  8. HDU 5578 Friendship of Frog 水题

    Friendship of Frog Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...

  9. HDU 5590 ZYB's Biology 水题

    ZYB's Biology Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid ...

随机推荐

  1. Rank of Tetris(hdu1811拓扑排序+并查集)

    题意:关于Rating的信息.这些信息可能有三种情况,分别是"A > B","A = B","A < B",分别表示A的Rati ...

  2. 【C语言】字符串替换空格:实现一个函数,把字符串里的空格替换成“%20”

    //字符串替换空格:实现一个函数,把字符串里的空格替换成"%20" #include <stdio.h> #include <assert.h> void ...

  3. sphinx 增量索引 及时更新、sphinx indexer索引合成时去旧和过滤办法(转)

    一.sphinx增量索引的设置    数据库中的已有数据很大,又不断有新数据加入到数据库中,也希望能够检索到.全部重新建立索引很消耗资源,因为我们需要更新的数据相比较而言很少.例如.原来的数据有几百万 ...

  4. android121 zhihuibeijing SlidingMenu(侧边栏效果,使用开源库)

    ## Splash ## - 旋转 RotateAnimation - 缩放 ScaleAnimation - 渐变 AlphaAnimation 工程可以作为一个库被其他工程当成一个Library使 ...

  5. java_可变参数构造器 Bulder模式

    package com.test1.www; class NutritionFacts { //必须 private int servingSize; private int servings; // ...

  6. linux实例 批量修改图片文件名

    1.如10.11一批这样的目录,10.11 10.12等等 然后里面的图片.jpg文件要修改成对应的日期.jpg,也就是说 编程1011.jpg这样的文件名 示例如下: #!/bin/bashfor ...

  7. c/c++编译原理

    转载自:http://blog.csdn.net/chengocean/article/details/6250779C源程序-->预编译处理(.c)-->编译.优化程序(.s..asm) ...

  8. ORACLE 优化

    本文主要从大型数据库ORACLE环境四个不同级别的调整分析入手,分析ORACLE的系统结构和工作机理,从九个不同方面较全面地总结了 ORACLE数据库的优化调整方案. 关键词 ORACLE数据库 环境 ...

  9. [转]为什么python标准库没有实现链表

    实际上刚开始学习一些高级语言的时候我也有同样的疑问,而且即使有链表对应物的语言,链表常常也很少被实际使用.如果是在国外听数据结构的课,老师一般会警告你这只是一个理论概念,实际应用应该实际考察,在通常情 ...

  10. Ubuntu 14.04 & ant: Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-7-openjdk-i386/lib/tools.jar

    当我在vagrant + ubuntu 14.04,jenkins ant执行项目的build.xml时,提示: [workspace] $ ant -file build.xml Unable to ...