View Code of Problem 70

    #include <stdio.h>
    #include <math.h>
    int main()
    {
    	int x,y,s;
    	scanf("%d",&x);
    	y=x/100000;
    	if(y>10)
    		y=10;
    	switch(y)
    	{
    	case 0:
    		s=x*0.1;
    		break;
    	case 1:
    		s=100000*0.1+(x-100000)*0.75;
    		break;
    	case 2:
    	case 3:
    		s=100000*0.1+100000*0.75+(x-200000)*0.05;
    		break;
    	case 4:
    	case 5:
    		s=100000*0.1+100000*0.75+200000*0.05+(x-400000)*0.03;
    		break;
    	case 6:
    	case 7:
    	case 8:
    	case 9:
    		s=100000*0.1+100000*0.75+200000*0.05+200000*0.03+(x-600000)*0.15;
    		break;
    	case 10:
    		s=100000*0.1+100000*0.75+200000*0.05+200000*0.03+400000*0.15+(x-1000000)*0.01;
    		break;
    	}
    	printf("%d",s);
    	return 0;
    }

Double click to view unformatted code.


Back to problem 70