Wednesday, July 20, 2016

uva 12342 solution

Unknown
#include<cstdio>
#include<cmath>
using namespace std;

int main()
{
    int tc,c=1;
    scanf("%d",&tc);
    while (tc--)
    {
        double income,tax=0;
        scanf("%lf",&income);
        income-=180000;
        if (income>300000)
        {
            tax+=300000*0.10;
            income-=300000;
        }
        else if (income>0)
        {
            tax+=income*0.10;
            goto print;
        }
        if (income>400000)
        {
            tax+=400000*0.15;
            income-=400000;
        }
        else if (income>0)
        {
            tax+=income*0.15;
            goto print;
        }
        if (income>300000)
        {
            tax+=300000*0.20;
            income-=300000;
        }
        else if (income>0)
        {
            tax+=income*0.20;
            goto print;
        }
        if (income>0)
        {
            tax+=income*0.25;
            goto print;
        }
        print:
        int ans=ceil(tax);
        if (ans<2000 && ans>0) ans=2000;
        printf("Case %d: %d\n",c++,ans);
    }
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,