各位大佬,新人求助!
这道题不算难,我逻辑没错,但只给90分,不知道怎么才能拿到100分,耽误大佬的几分钟时间,看看我这简单的C代码吧!
#include<stdio.h>
int main()
{
int T,S,A;
scanf("%d",&T);
if(T<=3500)
{
S=T;
}
else
{
A = T-3500;
int a,b,c,d,e,f,last,a_tax,b_tax,c_tax,d_tax,e_tax,f_tax;
a_tax = 1500 * 0.03;
b_tax = 3000 * 0.1;
c_tax = 4500 * 0.2;
d_tax = (35000-9000) * 0.25;
e_tax = (55000-35000) * 0.3;
f_tax = (80000-55000) * 0.35;
a = 1500 - a_tax;
b = 3000 - b_tax;
c = 4500 - c_tax;
d = (35000-9000) - d_tax;
e = (55000-35000) - e_tax;
f = (80000-55000) - f_tax;
if(T <= (3500+a))
last = A / (1-0.03);
else if(T > (3500+a) && T <= (3500+a+b))
last = (A + a_tax - 1500*0.1) / (1-0.1);
else if(T > (3500+a+b) && T <= (3500+a+b+c))
last = (A + a_tax + b_tax - 4500 * 0.2) / (1-0.2);
else if(T > (3500+a+b+c) && T <= (3500+a+b+c+d))
last = (A + a_tax + b_tax + c_tax - 9000*0.25) / (1-0.25);
else if(T > (3500+a+b+c+d) && T <= (3500+a+b+c+d+e))
last = (A + a_tax + b_tax + c_tax +d_tax - 35000*0.3) / (1-0.3);
else if(T > (3500+a+b+c+d+e) && T <= (3500+a+b+c+d+e+f))
last = (A + a_tax + b_tax + c_tax +d_tax +e_tax - 55000*0.35) / (1-0.35);
else
last = (A + a_tax + b_tax + c_tax +d_tax +e_tax + f_tax - 80000*0.45) / (1-0.45);
S = 3500 + last;
}
printf("%d\n",S);
return 0;
}