HDU - 4788 Hard Disk Drive (成都邀请赛H 水题)
HDU - 4788
Time Limit:1000MS | Memory Limit:32768KB | 64bit IO Format:%I64d & %I64u |
[Submit] [Go Back] [ id=47572" rel="nofollow">Status
Description
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
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
Sample Input
100[MB]
1[B]
Sample Output
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 水题)的更多相关文章
- 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 ...
- HDU 4788 Hard Disk Drive (2013成都H,水题) 进位换算
#include <stdio.h> #include <algorithm> #include <string.h> #include<cmath> ...
- hdu 4788 Hard Disk Drive (水题)
题意: Input The first line contains an integer T, which indicates the number of test cases. For each t ...
- HDU 5889 Barricade(最短路+最小割水题)
Barricade Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total ...
- hdu 1012:u Calculate e(数学题,水题)
u Calculate e Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- HDU 2674 N!Again(数学思维水题)
题目 //行开始看被吓一跳,那么大,没有头绪, //看了解题报告,发现这是一道大大大的水题,,,,,//2009 = 7 * 7 * 41//对2009分解,看它有哪些质因子,它最大的质因子是41,那 ...
- HDU 5832 A water problem (带坑水题)
A water problem 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5832 Description Two planets named H ...
- 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 ...
- HDU 4496 D-City (并查集,水题)
D-City Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Subm ...
随机推荐
- 前端面试题之一HTML
一.doctype作用? 严格模式与混杂模式如何区分?它们有何意义? (1)<!doctype>声明位于文档中的最前面的第一行,其作用告知浏览器用什么标准解析这个文档,并以浏览器支持的最高 ...
- jsp导出的word默认打开是web视图,希望是页面视图
方法1 ( velocity+java )我也遇到了这个问题,已经解决:1 .<html xmlns:v='urn:schemas-microsoft-com:vml'xmlns:o='urn: ...
- Scrapy框架Crawler模板爬虫
1.创建一个CrawlerSpider scrapy genspider -t crawl wx_spider 'wxapp-union.com' #导入规则 from scrapy.spiders ...
- Leetcode102. Binary Tree Level Order Traversal二叉树的层次遍历
给定一个二叉树,返回其按层次遍历的节点值. (即逐层地,从左到右访问所有节点). 例如: 给定二叉树: [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7 返回其 ...
- Leetcode506.Relative Ranks相对名次
给出 N 名运动员的成绩,找出他们的相对名次并授予前三名对应的奖牌.前三名运动员将会被分别授予 "金牌","银牌" 和" 铜牌"(" ...
- body-parser与querystring与multer的区别
body-parser express中间件 body-parser是用来解析http请求体的,是express默认使用的中间件之一. (只解析post的普通数据请求,无法解析post文件请求) 使用 ...
- LR自带网站飞机订票系统 启动
LR自带的网站:飞机订票系统 可是如何启动自带的网站呢?? 一.启动服务:开始-所有程序--HP Software-HP LoadRunner-Samples-Web-Start Web Server ...
- 读书笔记--Head First 面向对象分析与设计 目录
1.良好应用程序的基石 2.收集需求 3.需求变更 4.分析 5.良好的设计=灵活的软件 6.解决大问题 7.架构 8.设计原则 9.迭代与测试 10.OOA&D 的生命周期 附录1 附录2
- invalid use of null value
给mysql的数据表的一个字段插入数据,不成功, 然后在数据表设计中,把不是null勾选上,又提示 invalid use of null value 这种情况比较尴尬 只能删掉这一个字段,然后新建一 ...
- hql 条件查询 返回空的一种情况
为何会出现查询为空,但是查询整个表没问题的情况呢? 这里是没有分清字符串和变量 原来写的是, String hql = "from ClientInfoModel where clientI ...