View Code of Problem 96

#include<iostream>
#include<algorithm>
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<cstring>
#include<string>
#include<sstream>
#include<vector>
#include<map>
using namespace std;
struct human{
	string name;
	string sex;
	int y;
	int m;
	int d;
};
int main() {
	double num;
	char c;
	map<char,int> m;
	m['K']=1;
	m['M']=2;
	m['G']=3;
	m['T']=4;
	while(scanf("%lf%cB",&num,&c)!=EOF)
	{
		num/=10e16;
		double x,y,sum;
		x=num*pow(1024,m[c]);
		y=num*pow(1000,m[c]);
		sum=x-y;
		printf("%.lf\n",sum*10e16);
	}
	return 0;

}

Double click to view unformatted code.


Back to problem 96