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. 如何用js造轮子

    写了一个非常通俗易懂的造轮子的方法 <div class="wrap"></div> <div class="wrap">& ...

  2. 装配SpringBean(一)--依赖注入

    所谓依赖注入,我觉得说白了其实就是给成员变量赋值,不管这个成员变量是基本类型还是引用类型,Spring中常用的依赖注入方式有两种: 1.构造器注入 2.setter注入 下面通过代码实例说明这两种注入 ...

  3. vue 路由(二级)配置及详细步骤

    1.安装插件(可以选择在初始化项目的时候安装) cnpm install vue-router --save-dev 2.将插件全局引入到项目中(main.js) import VueRouter f ...

  4. 微端 打包更新工具 as air 分享

    分享 微端,更新的是散包,不像端游,一个大包搞定. 更新须要每次用工具把资源的散文件.依据文件夹结构及时间 生成一个列表, 每次更新就是 文件夹及时间的比对! 该project能够翻译成 其它语言.有 ...

  5. 【One by one系列】一步步部署.net core应用

    我们的目标: CentOS系统 nginx服务器 asp.net core应用 mysql服务器 腾讯云服务器 工具准备 [Xshell]--使用windwos下的工具Xshell,原理就是使用SHH ...

  6. [BZOJ2427][HAOI2010]软件安装-tarjan缩点-树上dp

    <题面> 这个题真伤人 之前Tarjan和树规都没学好,吃了不少亏,仔仔细细的搞了一天,收获颇丰 先来一个Tarjan的链接:$\mathbb{O}$ 题目的数据比较友好: $dp$不对: ...

  7. SpringBoot集成lombook让代码更简洁

    1)添加lombok依赖 <dependency> <groupId>org.projectlombok</groupId> <artifactId>l ...

  8. go语言:获取字符串长度

    go语言字符串底层由字节数组实现,使用UTF-8编码,初始化以后不能被修改 获取字符串长度 一.当字符串中所有字符都是单字节字符时,使用 len 函数获取字符串的长度 package main imp ...

  9. Spring Boot邮件功能

    1.应用场景 邮件功能的应用场景可谓十分广泛,诸如注册用户.密码找回,消息通知.以及一些程序异常通知等都需要使用到该功能. 正是由于邮件功能的使用广泛,因此springboot也加在它的组件中添加了邮 ...

  10. Linux部署教育云平台测试环境总结

    2016年10月16日换了新公司,刚进公司就要进行平台测试环境部署,由于之前Linux用的比较少,只用过几个简单的杀进程.重启tomcat.查看日志等简单的操作命令,真要在LInux服务器上部署环境的 ...