HDU - 4788

Time Limit:1000MS   Memory Limit:32768KB   64bit IO Format:%I64d & %I64u

[Submit]  [Go Back]  [

id=47572" rel="nofollow">Status]  

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 <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std; int n;
char u[8]; int main()
{
while (scanf("%d", &n) != EOF) {
for (int cas = 1; cas <= n; cas++) {
scanf("%*d%s", u);
printf("Case #%d: ", cas);
if (u[1] == 'B')
printf("0.00");
else if (u[1] == 'K')
printf("2.34");
else if (u[1] == 'M')
printf("4.63");
else if (u[1] == 'G')
printf("6.87");
else if (u[1] == 'T')
printf("9.05");
else if (u[1] == 'P')
printf("11.18");
else if (u[1] == 'E')
printf("13.26");
else if (u[1] == 'Z')
printf("15.30");
else if (u[1] == 'Y')
printf("17.28");
printf("%%\n");
}
}
return 0;
}

HDU - 4788 Hard Disk Drive (成都邀请赛H 水题)的更多相关文章

  1. 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 ...

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

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

  3. hdu 4788 Hard Disk Drive (水题)

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

  4. HDU 5889 Barricade(最短路+最小割水题)

    Barricade Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total ...

  5. hdu 1012:u Calculate e(数学题,水题)

    u Calculate e Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tot ...

  6. HDU 2674 N!Again(数学思维水题)

    题目 //行开始看被吓一跳,那么大,没有头绪, //看了解题报告,发现这是一道大大大的水题,,,,,//2009 = 7 * 7 * 41//对2009分解,看它有哪些质因子,它最大的质因子是41,那 ...

  7. HDU 5832 A water problem (带坑水题)

    A water problem 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5832 Description Two planets named H ...

  8. hdu 5742 It's All In The Mind 水题

    It's All In The Mind 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5742 Description Professor Zhan ...

  9. HDU 4496 D-City (并查集,水题)

    D-City Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Subm ...

随机推荐

  1. python基础---内置函数 和 匿名函数 知识点自查填空题

    1.file ---默认是输出到(),如果设置为(),输出到() 2.sep---打印(),默认为() 3.end---每一次打印的结尾,默认为() 4.flush---立即把内容输出到(),不做() ...

  2. 转:LPC2214的PLL与定时器设置

    原地址:http://blog.sina.com.cn/s/blog_4419d72d0100mu7h.html LPC2214的PLL与定时器设置 http://www.dpj365.cn/bbs/ ...

  3. 装配SpringBean(五)--注解装配之自动装配

    在spring ioc容器中,spring要先完成bean的定义和生成,然后需要需要注入的资源,在上一篇的扫描组件中就是这样实现的.而自动装配中我们只需要定义和生成一个bean,发现bean的过程将由 ...

  4. PHP中的符号 ->、=> 和 :: 的含义(用法)

    php新手经常碰到的问题,->.=> 和 :: 这三个家伙是什么分别都是做什么的啊!看着就很晕. 没关系,下面我们做一下详细的解释,如果你有C++,Perl基础,你会发现这些家伙和他们里面 ...

  5. [Day6] Nginx 进阶模块

    一. 使用变量防盗链referer模块 功能:通过验证referer请求头是否合法,来拒绝非正常的网站访问我们站点的资源 思路:通过referer模块,用invaild_refereri变量根据配置判 ...

  6. python-基础-基础知识-变量-选择-循环

    1 基础知识 1.1 注释的分类 1.2 变量以及类型 变量定义 num1 = 100 #num1就是一个变量,就好一个小菜篮子 num2 = 87 #num2也是一个变量 result = num1 ...

  7. SVN添加自动忽略文件.settings .project .classpath target等

    eclipse svn提交忽略文件及文件夹,ignore设置无效.. 一.方法: 1. 将文件夹或文件从Eclipse中删除.记得要在Eclipse中删除,而不是Windows文件管理界面删除. 2. ...

  8. 教你用webpack搭一个vue脚手架[超详细讲解和注释!](转载)

    1.适用人群 1.对webpack知识有一定了解但不熟悉的同学. 2.女同学!!!(233333....) 2.目的 在自己对webpack有进一步了解的同时,也希望能帮到一些刚接触webpack的同 ...

  9. vue下使用nginx刷新页面404

    nginx 是一个代理的服务器.出现的问题:写好的页面通过nginx作为代理的服务器给别的同事看的时候发现了新写的页面打开就404,并且从其他页面跳转可以看到但是刷新页面就404.解决方法:在文件中的 ...

  10. 修改input标签输入样式

    去掉input自带的边框: border-style:none;修改input输入的文字样式: input{ font-size: 24px; color:#5d6494; } 修改input框中占位 ...