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