很常识的一个问题,在硬盘制造中,厂家认为的比例是1:1000,而平时用的比例是1:1024,给出硬盘大小,问损失的百分比。
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<ctime>
#include<stdio.h>
#include<cstdlib>
#include<functional>
#include<cmath>
using namespace std;
#define PI acos(-1.0)
#define MAXN 110
#define eps 1e-7
#define INF 0x7FFFFFFF
#define seed 131
#define ll long long
#define ull unsigned ll
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
double p[10];
void getp()
{
for(int i=1;i<10;i++)
{
p[i]=(pow(1024.0,i*1.0)-pow(1000.0,i*1.0))/pow(1024.0,i*1.0);
p[i]*=100;
}
}
int main ()
{
int n;
scanf("%d",&n);
int x;
char y[5];
getp();
for(int i=1;i<=n;i++)
{
scanf("%d%s",&x,y);
//printf("%d %s\n",x,y);
printf("Case #%d: ",i);
if(y[0]=='['&&y[1]=='B') printf("%.2lf%%%\n",p[0]);
if(y[0]=='['&&y[1]=='K') printf("%.2lf%%%\n",p[1]);
if(y[0]=='['&&y[1]=='M') printf("%.2lf%%%\n",p[2]);
if(y[0]=='['&&y[1]=='G') printf("%.2lf%%%\n",p[3]);
if(y[0]=='['&&y[1]=='T') printf("%.2lf%%%\n",p[4]);
if(y[0]=='['&&y[1]=='P') printf("%.2lf%%%\n",p[5]);
if(y[0]=='['&&y[1]=='E') printf("%.2lf%%%\n",p[6]);
if(y[0]=='['&&y[1]=='Z') printf("%.2lf%%%\n",p[7]);
if(y[0]=='['&&y[1]=='Y') printf("%.2lf%%%\n",p[8]);
}
}