题意:

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. scrum项目冲刺_day02总结

    摘要:今日完成任务. 1.appUI页面完成 2.图像识别正在进行 总任务: 一.appUI页面(已完成) 二.首页功能: 1.图像识别功能 2.语音识别功能 3.垃圾搜索功能 4.相关新闻爬取 三. ...

  2. Java基础系列(19)- Switch结构

    package struct; public class SwitchDemo01 { //case穿透 //switch 匹配一个具体的值 public static void main(Strin ...

  3. python BeautifulSoup html解析

    * BeautifulSoup 的.find(), .findAll() 函数原型 findAll(tag, attributes, recursive, text, limit, keywords) ...

  4. 博客调网易云歌单JS

    <!--音乐--> <link rel="stylesheet" href="https://blog-static.cnblogs.com/files ...

  5. 在modal中的datetimepicker插件BUG修复

    前言:因为在模态框用到datetimepicker这一日期控件,而选中日期时,会触发模态框的再次打开,导致上面表单选的值会重新加载 解决办法: 用stopPropagation() 方法阻止事件传播, ...

  6. Dapr + .NET Core实战(七)Secrets

    什么是Secrets 应用程序通常会通过使用专用的存储来存储敏感信息,如连接字符串.密钥等. 通常这需要建立一个密钥存储,如Azure Key Vault.Hashicorp等,并在那里存储应用程序级 ...

  7. React-高阶函数_函数柯里化

    高阶函数_函数柯里化 高阶函数(定义) 如果一个函数符合下面两个规范,就是高阶函数: 如果A函数,接收的参数是一个函数,那么A就是一个高阶函数(比如数组方法arr.map()接收的就是一个处理item ...

  8. 3-等待线程终止的join方法

    等待线程终止的join方法 在项目实践中经常会遇到一个场景,就是需要等待某几件事完成之后才能继续往下执行,比如线程加载资源等等. package com.heiye.learn1; public cl ...

  9. Dart 中的final 和 const

    Dart 常量和常量值 final 和 const 两个关键字用来定义常量,有什么区别呢? final 声明的是运行时常量,const声明的是编译时常量 const 可以声明常量值 举个例子: imp ...

  10. mybatis-plus最新版代码生成器(Swagger3)

    写项目想用mybatis-plus+swagger3,百度最新版代码生成器都是旧版的,且官网的配置过于简洁,所以手敲一份,在官网的基础上加了一堆配置,lombok,restful,mvc三层结构目录等 ...