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. php7开启强类型模式

    版权声明: https://blog.csdn.net/shi_yi_fei/article/details/52006809 我们知道php是一种弱类型的编程语言,但是php7已经有所改变,可以支持 ...

  2. jeecms添加站点

    Step1:点击[站点管理],然后点击[添加站点]. Step2:按照下图填写,注意[路径]这一栏!!这里我随便写了个[aaa]. Step3:这个时候在本地部署的tomcat的模板路径:tomcat ...

  3. eureka添加security验证之后,client注册失败

    高版本,以下配置已弃用 security: basic: enabled: true 所以需要自定义security配置开启basic认证,参考我的配置类 @Configuration @Enable ...

  4. 通过BlukLoad的方式快速导入海量数据

    http://www.cnblogs.com/MOBIN/p/5559575.html 摘要 加载数据到HBase的方式有多种,通过HBase API导入或命令行导入或使用第三方(如sqoop)来导入 ...

  5. 阿里面试题,为什么wait()方法要放在同步块中?

    某天我在***的时候,突然有个小伙伴微信上说:“哥,阿里面试又又挂了,被问到为什么wait()方法要放在同步块中,没答出来!” 我顿时觉得**一紧,仔细回顾一下,如果wait()方法不在同步块中,代码 ...

  6. UVA10253 Series-Parallel Networks

    Series-Parallel Networks https://vjudge.net/problem/UVA-10253 如果用一个节点表示串联/并联操作,用一棵树表示每一个串并联网络,要求一个节点 ...

  7. git与github建立链接(学习笔记)

    总结步骤: 1.将所有文件添加到本库 git add . 2. git commit -m "提示信息随便写" 3.查看git修改状态 git status 4.获取远程库与本地同 ...

  8. java的dao层如何返回多个list

    比如一个场景 我要这样展示(相同的元素只要展示一次) 前台是这样写的 el表达式是不能对数据进行处理的,所以数据有重复的那么就一定会显示出来 所以,考虑,能不能直接在dao中查询的时候直接返回三个li ...

  9. day38 08-Spring的id、name和scope顺序

    访问的路径的是/login.id不允许出现特殊的字符./是特殊的字符.Struts 2已经没有/,action的名字已经不带/了.现在的开发中一般使用id这个属性即可. 这个类在被Spring创建的时 ...

  10. tcpdump命令介绍

    命令格式为:tcpdump [-nn] [-i 接口] [-w 储存档名] [-c 次数] [-Ae] [-qX] [-r 文件] [所欲捕获的数据内容] 参数: -nn,直接以 IP 及 Port ...