View Code of Problem 96

#include <stdio.h>
#include <math.h>
int main(){
	long long n;
	while(scanf("%d",&n)!=EOF&&n!=0){
		char a[2];
		long long all;
		scanf("%s",a);
		if(a[0]=='T'){
			all=(long long)n*(pow(1024,4)-pow(1000,4));
		}
		if(a[0]=='G'){
			all=(long long)n*(pow(1024,3)-pow(1000,3));
		}
		if(a[0]=='M'){
			all=(long long)n*(pow(1024,2)-pow(1000,2));
		}
		if(a[0]=='K'){
			all=(long long)n*(pow(1024,1)-pow(1000,1));
		}
		if(a[0]=='B'){
			all=0;
		}
		printf("%lld\n",all);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 96