View Code of Problem 96

#include <bits/stdc++.h>
using namespace  std;
int main()
{
    long long int n,t,f;
    string s;
    while(cin>>n>>s)
    {
        if(n==0)
            break;
        if(s=="B")
        {
            printf("0\n");
        }
        else if(s=="KB")
        {
            t=n*1024;
            f=n*1000;
            printf("%lld\n",t-f);
        }
        else if(s=="MB")
        {
            t=n*1024*1024;
            f=n*1000*1000;
            printf("%lld\n",t-f);
        }
        else if(s=="GB")
        {
            t=n*1024*1024*1024;
            f=n*1000*1000*1000;
            printf("%lld\n",t-f);
        }
        else if(s=="TB")
        {
            t=n*1024*1024*1024*1024;
            f=n*1000*1000*1000*1000;
            printf("%lld\n",t-f);
        }
    }
}

/*
Main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
 #include <bits/stdc++.h>
          ^~~~~~~~~~~~~~~
compilation terminated.
*/

Double click to view unformatted code.


Back to problem 96