hdu 4788 Hard Disk Drive(水)
2015-10-22 19:33
344 查看
题目链接:hdu 4788 Hard Disk Drive
代码
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; int idx(char ch) { if (ch == 'B') return 0; if (ch == 'K') return 1; if (ch == 'M') return 2; if (ch == 'G') return 3; if (ch == 'T') return 4; if (ch == 'P') return 5; if (ch == 'E') return 6; if (ch == 'Z') return 7; if (ch == 'Y') return 8; return 0; } int main () { int cas; scanf("%d", &cas); for (int kcas = 1; kcas <= cas; kcas++) { double k, p = 1; char s[5]; scanf("%lf[%s]", &k, s); int n = idx(s[0]); for (int i = 0; i < n; i++) p = p * 1000 / 1024; printf("Case #%d: %.2lf%%\n", kcas, 100.0 * (1-p)); } return 0; }
相关文章推荐
- iOS开发拓展篇—UIDynamic(重力行为+碰撞检测)
- 关于Quartz 2D绘图的简单使用
- openOffice在linux和window转的有些不同
- hadoop学习第一天
- Recruit Coupon Purchase Winner's Interview: 2nd place, Halla Yang
- spring mvc配置ObjectMapper忽略无法识别的字段,以及一些博客推荐
- 对几种流行的Javascript模板引擎的测试对比
- 关键字
- iOS开发拓展篇—UIDynamic(简单介绍)
- 最小的k个数
- Getting started with machine learning in Python
- hdu 4790 Just Random(计数)
- Opencv + vs2012环境配置
- android路上的点点滴滴
- Linux Programing -- ch12-- POSIX 线程
- 使用Spring容器取出Bean时的奇怪的ClassCastException
- 图灵机器人(智能云交互API)的一个java实现简单例子
- iOS开发拓展篇—静态库
- 兄弟连Linux学习笔记之文件处理命令
- 内聚耦合备忘