View Code of Problem 96

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

Double click to view unformatted code.


Back to problem 96