1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
#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; } |