题意:

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%

代码:

int T;
char s[100]; ll Pow(int a,int x){
ll res = 1;
rep(i,1,x) res *= (ll)a;
return res;
}
int main(){
cin >> T;
rep(t,1,T){
scanf("%s",s);
int l = strlen(s);
char x = s[l-3];
int a;
switch(x){
case '[': a=0; break;
case 'K': a=1; break;
case 'M': a=2; break;
case 'G': a=3; break;
case 'T': a=4; break;
case 'P': a=5; break;
case 'E': a=6; break;
case 'Z': a=7; break;
case 'Y': a=8; break;
}
ll A = Pow(125,a), B = Pow(128,a);
//printf("%I64d %I64d\n",A,B);
double ans = (double)100 - ((double)A*100/(double)B);
printf("Case #%d: %.2lf%%\n",t,ans);
}
}

hdu 4788 Hard Disk Drive (水题)的更多相关文章

  1. HDU - 4788 Hard Disk Drive (成都邀请赛H 水题)

    HDU - 4788 Hard Disk Drive Time Limit:1000MS   Memory Limit:32768KB   64bit IO Format:%I64d & %I ...

  2. 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 ...

  3. HDU 4788 Hard Disk Drive (2013成都H,水题) 进位换算

    #include <stdio.h> #include <algorithm> #include <string.h> #include<cmath> ...

  4. HDU 5578 Friendship of Frog 水题

    Friendship of Frog Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...

  5. HDU 5590 ZYB's Biology 水题

    ZYB's Biology Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid ...

  6. HDU 5538 L - House Building 水题

    L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...

  7. hdu 1005:Number Sequence(水题)

    Number Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  8. hdu 1018:Big Number(水题)

    Big Number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

  9. hdu 2041:超级楼梯(水题,递归)

    超级楼梯 Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Submission(s): Accepted Su ...

随机推荐

  1. 低代码+RPA+AI,能否让ERP焕发下一春?

    从2004年开始,国内ERP项目的实施便在各大企业热火朝天地展开,2014年,国内大中型企业已经基本完成了ERP系统的普及.ERP已经在大中型企业中成为不可或缺的关键信息系统.企业核心业务的流转与管控 ...

  2. phpstorm 配置Psr4 风格代码

    http://www.cnblogs.com/xp796/p/6441700.html

  3. django2获取url所有路径

    根据原文链接:https://segmentfault.com/a/1190000017378464,整理 第一步:先导入项目根的urls.py路径 from ceshiproject import ...

  4. LR11自带网站

    LR自带的飞机订票系统 启动服务:安装路径\HP\LoadRunner\WebTours下的StartServer.bat 打开网页:地址  http://127.0.0.1:1080/WebTour ...

  5. 『Python』进程同步

    1. Lock(互斥锁) 是可用的最低级的同步指令.Lock处于锁定状态时,不被其他的线程拥有. from multiprocessing import Process, Value, Lock de ...

  6. 关于微信小程序爬虫关于token自动更新问题

    现在很多的app都很喜欢在微信或者支付宝的小程序内做开发,毕竟比较方便.安全.有流量.不需要再次下载app,好多人会因为加入你让他下载app他会扭头就走不用你的app,毕竟做类似产品的不是你一家. 之 ...

  7. 使用jacob调用Windows的com对象,进行word、ppt等转换成ptf、html(二)

    富文本转pdf : 注意:simsun.ttc 可以百度下载:http://www.pc6.com/softview/SoftView_100415.html package com.orangecd ...

  8. Pycharm新建模板默认添加作者时间等信息(逼格更高,好像很历害的样子)

    在pycharm使用过程中,关于代码编写者的一些个人信息快捷填写,使用模板的方式比较方便. 方法如下: 1.打开pycharm,选择File-Settings 2.选择Editor--Color&am ...

  9. Python3入门系列之-----异常处理

    前言 作为 Python 初学者,在刚学习 Python 编程时,经常会看到一些报错信息,在前面我们没有提及,这章节我们会专门介绍. Python 有两种错误很容易辨认:语法错误和异常. Python ...

  10. 深入浅出WPF-05.控件与布局

    控件与布局 突出特点:1.专门的UI设计语言XAML,无需像MFC那样使用编程语言设计UI.2.前几代在UI和数据交互方面是由消息Message到控件事件,始终是把UI控件放在主导位置而把数据放在了次 ...