View Code of Problem 96

#include<bits/stdc++.h>
using namespace std;
#define max 100001
int main(){
	int n;
	string s;
	double sum;
	while(cin>>n){
		if(n==0)exit(1);
		cin>>s;
		if(s[0]=='K') sum = n*24;
		else if(s[0]=='M') sum = n*(pow(1024,2)-pow(1000,2));
		else if(s[0]=='G') sum = n*(pow(1024,3)-pow(1000,3));
		else if(s[0]=='T') sum = n*(pow(1024,4)-pow(1000,4));
		printf("%.0lf\n",sum);
		sum = 0; 
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 96