您的位置:首页 > 其它

[HDOJ4788]Hard Disk Drive(水题)

2016-09-21 20:23 218 查看
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4788

题意:1KB有的时候认为是1000B,有的时候是1024B。问两种方法之间的损失。

YY个公式水过。

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <climits>
#include <complex>
#include <cassert>
#include <cstdio>
#include <bitset>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <ctime>
#include <set>
#include <map>
#include <cmath>
using namespace std;
#define fr first
#define sc second
#define cl clear
#define BUG puts("here!!!")
#define W(a) while(a--)
#define pb(a) push_back(a)
#define Rint(a) scanf("%d", &a)
#define Rll(a) scanf("%I64d", &a)
#define Rs(a) scanf("%s", a)
#define Cin(a) cin >> a
#define FRead() freopen("in", "r", stdin)
#define FWrite() freopen("out", "w", stdout)
#define Rep(i, len) for(int i = 0; i < (len); i++)
#define For(i, a, len) for(int i = (a); i < (len); i++)
#define Cls(a) memset((a), 0, sizeof(a))
#define Clr(a, x) memset((a), (x), sizeof(a))
#define Full(a) memset((a), 0x7f7f7f, sizeof(a))
#define lrt rt << 1
#define rrt rt << 1 | 1
#define pi 3.14159265359
#define RT return
#define lowbit(x) x & (-x)
#define onecnt(x) __builtin_popcount(x)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
typedef pair<LL, LL> pll;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef vector<vl> vvl;
typedef vector<bool> vb;

const int maxn = 1010;
double tmp;
char s[maxn];
map<char, int> q;

signed main() {
// FRead();
int T, _ = 1;
Rint(T);
q['B'] = 1;q['K'] = 2;q['M'] = 3;q['G'] = 4;
q['T'] = 5;q['P'] = 6;q['E'] = 7;q['Z'] = 8;
q['Y'] = 9;
W(T) {
scanf("%lf[%s", &tmp, s);
printf("Case #%d: ", _++);
int t = q[s[0]] - 1;
double ret = pow(1000.0, t) / pow(1024.0, t);
printf("%.2lf%%\n", (double)(1.0 - ret) * 100.0);
}
RT 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: