标签:
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4788
题意:1KB有的时候认为是1000B,有的时候是1024B。问两种方法之间的损失。
YY个公式水过。
1 #include <algorithm> 2 #include <iostream> 3 #include <iomanip> 4 #include <cstring> 5 #include <climits> 6 #include <complex> 7 #include <cassert> 8 #include <cstdio> 9 #include <bitset> 10 #include <vector> 11 #include <deque> 12 #include <queue> 13 #include <stack> 14 #include <ctime> 15 #include <set> 16 #include <map> 17 #include <cmath> 18 using namespace std; 19 #define fr first 20 #define sc second 21 #define cl clear 22 #define BUG puts("here!!!") 23 #define W(a) while(a--) 24 #define pb(a) push_back(a) 25 #define Rint(a) scanf("%d", &a) 26 #define Rll(a) scanf("%I64d", &a) 27 #define Rs(a) scanf("%s", a) 28 #define Cin(a) cin >> a 29 #define FRead() freopen("in", "r", stdin) 30 #define FWrite() freopen("out", "w", stdout) 31 #define Rep(i, len) for(int i = 0; i < (len); i++) 32 #define For(i, a, len) for(int i = (a); i < (len); i++) 33 #define Cls(a) memset((a), 0, sizeof(a)) 34 #define Clr(a, x) memset((a), (x), sizeof(a)) 35 #define Full(a) memset((a), 0x7f7f7f, sizeof(a)) 36 #define lrt rt << 1 37 #define rrt rt << 1 | 1 38 #define pi 3.14159265359 39 #define RT return 40 #define lowbit(x) x & (-x) 41 #define onecnt(x) __builtin_popcount(x) 42 typedef long long LL; 43 typedef long double LD; 44 typedef unsigned long long ULL; 45 typedef pair<int, int> pii; 46 typedef pair<string, int> psi; 47 typedef pair<LL, LL> pll; 48 typedef map<string, int> msi; 49 typedef vector<int> vi; 50 typedef vector<LL> vl; 51 typedef vector<vl> vvl; 52 typedef vector<bool> vb; 53 54 const int maxn = 1010; 55 double tmp; 56 char s[maxn]; 57 map<char, int> q; 58 59 signed main() { 60 // FRead(); 61 int T, _ = 1; 62 Rint(T); 63 q[‘B‘] = 1;q[‘K‘] = 2;q[‘M‘] = 3;q[‘G‘] = 4; 64 q[‘T‘] = 5;q[‘P‘] = 6;q[‘E‘] = 7;q[‘Z‘] = 8; 65 q[‘Y‘] = 9; 66 W(T) { 67 scanf("%lf[%s", &tmp, s); 68 printf("Case #%d: ", _++); 69 int t = q[s[0]] - 1; 70 double ret = pow(1000.0, t) / pow(1024.0, t); 71 printf("%.2lf%%\n", (double)(1.0 - ret) * 100.0); 72 } 73 RT 0; 74 }
标签:
原文地址:http://www.cnblogs.com/vincentX/p/5894018.html