View Code of Problem 70

#include<cstdio>
int f(int x){
	int ans;
	if(x<=100000)	ans=x*0.1;
	else if(x<=200000)	ans=10000+0.075*(x-100000);
	else if(x<=400000)	ans=10000+0.075*100000+0.05*(x-200000);
	else if(x<=600000)	ans=10000+0.075*100000+0.05*200000+0.03*(x-400000);
	else if(x<=1000000)	ans=10000+0.075*100000+0.08*200000+0.015*(x-600000);
	else	ans=10000+0.075*100000+0.08*200000+0.015*400000+0.01*(x-1000000);
	
	return ans;
}
int main(){
	int x;
	scanf("%d",&x);
	printf("%d",f(x));
	return 0;
} 

Double click to view unformatted code.


Back to problem 70