12342

#include <iostream>
#include <stdio.h>
#include <math.h>

using namespace std;

double _max(double a,double b)
{
	if(a>b)
	return a;
	else
	return b;
}

int main()
{
	int t,c=1;
	double a,b,cx;
	cin>>t;

	while(t--)
	{
		cin>>a;
		if(a<=180000)
		{
			cout<<"Case "<<c++<<": "<<0<<"\n";
			continue;
		}
		cx=0;
		if((a-1180000)>0)
		{
			cx+=(a-1180000)*.25;
			a-=(a-1180000);
		}
		if((a-880000)>0)
		{
			cx+=(a-880000)*.2;
			a-=(a-880000);
		}
		if((a-480000)>0)
		{
			cx+=(a-480000)*.15;
			//cout<<"dd1 "<<(a-480000)<<"\n";
			a-=(a-480000);
		}
		if((a-180000)>0)
		{

			b=(a-180000)*.1;
			b=_max(b,2000);
			cx+=b;

		}

		cout<<"Case "<<c++<<": ";
		printf("%.0lf\n",ceil(cx));
	}

	return 0;
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *