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

Posted blues

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HDU 4788 Hard Disk Drive (2013成都H,水题) 进位换算相关的知识,希望对你有一定的参考价值。

技术分享
 1 #include <stdio.h>
 2 #include <algorithm>
 3 #include <string.h>
 4 #include<cmath>
 5 using namespace std;
 6 double a;
 7 char s[100];
 8 int fun(char s[]) {
 9     if(strcmp(s,"B]") == 0)return 0;
10     if(strcmp(s,"KB]") == 0)return 1;
11     if(strcmp(s,"MB]") == 0)return 2;
12     if(strcmp(s,"GB]") == 0)return 3;
13     if(strcmp(s,"TB]") == 0)return 4;
14     if(strcmp(s,"PB]") == 0)return 5;
15     if(strcmp(s,"EB]") == 0)return 6;
16     if(strcmp(s,"ZB]") == 0)return 7;
17     if(strcmp(s,"YB]") == 0)return 8;
18 }
19 int main() {
20 //    freopen("in.txt","r",stdin);
21     int t;
22     scanf("%d",&t);
23     int cas=0;
24     while(t--) {
25         scanf("%lf[%s",&a,s);
26         cas++;
27         int num=fun(s);
28         double ans=pow(1000.0,num)/pow(1024.0,num);
29         ans=1-ans;
30         printf("Case #%d: %.2lf%%\n",cas,ans*100);
31     }
32     return 0;
33 }
View Code

 

以上是关于HDU 4788 Hard Disk Drive (2013成都H,水题) 进位换算的主要内容,如果未能解决你的问题,请参考以下文章

[HDOJ4788]Hard Disk Drive(水题)

请问:电脑设置中FIOPPY、LS120、hard Disk 、 CDROM 、 Zip、 USB-FDD 、 LAN 和IDE分别是啥意思?

请问:电脑设置中FIOPPY、LS120、hard Disk 、 CDROM 、 Zip、 USB-FDD 、 LAN 和IDE分别是啥意思?

Ubuntu remount hard drive

VirtualBox 导入vdi时报错 Cannot register the hard disk because a hard disk '' with UUID already e

Programmatically mount a Microsoft Virtual Hard Drive (VHD)