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 ...
随机推荐
- main函数执行前后还会发生什么
问题分析 首先main()函数只不过是提供了一个函数入口,在main()函数中的显示代码执行之前,会由编译器生成_main函数,其中会进行所有全局对象的构造以及初始化工作.简单来说对静态变量.全局变量 ...
- 一维、二维数组 与 常用的返回数组 以及 fetch_all与fetch_row的区别
一维数组:单行单列的数组. 二维数组:多行多列的数组. (至少两行两列) 索引数组: fetch_all() 返回所有数组 fetch_row() 返回一行或一列数组 (第二行需要输入两 ...
- Python爬虫笔记【一】模拟用户访问之Tesseract-ocr验证码训练(5)
验证码处理之后就需要对处理的验证码进行识别训练,这里用Tesseract-ocr工具进行识别,用jTessBoxeditor进行训练生成模板. 一,对图片进行处理 利用上一篇代码对图片进行降噪处理,得 ...
- python scikit-learn计算tf-idf词语权重
python的scikit-learn包下有计算tf-idf的api,研究了下做个笔记 1 安装scikit-learn包 sudo pip install scikit-learn 2 中文分 ...
- 【python之路41】web框架
一.web框架介绍 一共有两种web框架 1.既包含socket又能逻辑处理 tornado框架 2.只能处理逻辑 Django bottle flask 二.web框架的本质 众所周知,对于所有的 ...
- PHP拓展 - xhprof性能分析工具
Windows安装 参考:https://www.cnblogs.com/buexplain/p/4821619.html dll文件下载:https://windows.php.net/downlo ...
- linux apache vhost
<VirtualHost *:80> DocumentRoot "/usr/www/yltgerp_old/" ServerName erp.yltg.com.cn E ...
- 详解WPF DockPanel的LastChildFill属性
MSDN解释: 获取或设置一个值,该值指示 System.Windows.Controls.DockPanel 中的最后一个子元素是否拉伸以填充剩余的可用空间. 返回: 如果最后一个子元素拉伸以填充剩 ...
- C++ std::map用法简介
#include "map" //引入头文件 初始化: std::map <int, std::string> _map1; //初始化 //c++11中引入的,可以直 ...
- org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.hs.model.StudentModel]: No default constructor found; nested exception is java.lang.NoSuchMethodException: c
root cause org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [c ...