Tuesday, December 6, 2016

UVa 12555

#include<bits/stdc++.h>

using namespace std;

int main()
{
 int t,sz,a;
 int kase=1;
 double res;
 string inp;

 cin>>t;

 while(t--){
  
  res=0;
  cin>>a;
  cin>>inp;
  
  sz=inp.size();
  
  if(sz <= 4) res = a * .5;
  else res = (inp[3]-'0') * .05 + a * .5;
  
  cout<<"Case "<<kase<<": ";
  cout<<res<<endl;
  kase++;

 }

 return 0;

}

//translation chinese to english :D
//.5kg =  jin 
//.05 = two
// so "5 jin 2 two" consider it :)