题意:

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. layui日期选择无效的问题

    解决layui引入时间控件无效的问题 - 简书 (jianshu.com) 原因是因为在使用日期选择器的时候,layui源码里有一个laydate.css文件找不到 将下载的文档文件里的css文件夹, ...

  2. 网页兼容最新IE声明meta方法

    第三种,总是使用最新版本文档模式. 以下是例子: <meta http-equiv="X-UA-Compatible" content="IE=edge" ...

  3. Shell系列(12)- 预定义变量(5)

    预定义变量 作用 $? 常用:最后一次执行的命令的返回状态. 如果这个变量的值为0,证明上一个命令正确执行:如果这个变量的值为非0(具体是哪个数,由命令自己来决定),则证明上一个命令执行不正确了 $$ ...

  4. 压测中的QPS与TPS区别

    原文来自:https://www.cnblogs.com/fkkk/p/11957566.html QPS(每秒查询率)=并发数/平均响应时间 TPS(每秒处理事务数)=请求数/时间(秒) TPS的过 ...

  5. windows使用VS编译python源码

    使用VS2021编译python源码 说明,使用VS2019也是可以的. 环境准备 对于VS2019首要要安装必要的环境 到python官网下载源码压缩包以及解压(红色箭头任选一个都行) 打开下载好的 ...

  6. [USACO10NOV]Buying Feed G

    part 1 暴力 不难发现有一个 $\mathcal O(K^2n)$ 的基础 dp: $$f_{i,j+l}=\min(f_{i,j+l},f_{i-1,j}+(x_i-x_{i-1})jj+c_ ...

  7. ubuntu20.04安装网易云音乐

    Ubuntu20.04安装网易云 进入网易云音乐下载地址 下载对应客户端 进入终端,安装 sudo dpkg -i 软件名.deb

  8. Serverless 在大规模数据处理的实践

    作者 | 西流 阿里云技术专家 前言 当您第一次接触 Serverless 的时候,有一个不那么明显的新使用方式:与传统的基于服务器的方法相比,Serverless 服务平台可以使您的应用快速水平扩展 ...

  9. 快速入门maven

    1.快速介绍 maven(翻译:专家,内行)是apache(一个公司/组织)做的一个项目,或者说是软件,这个东西可以干什么? 可以用它来对咱们做的项目进行改进,增加开发效率,比如帮助你自动导入jar包 ...

  10. Spring的JDK动态代理如何实现的(源码解析)

    前言 上一篇文章中提到了SpringAOP是如何决断使用哪种动态代理方式的,本文接上文讲解SpringAOP的JDK动态代理是如何实现的.SpringAOP的实现其实也是使用了Proxy和Invoca ...