编程写不了,只能直接手算出来了。。。。。
数据说明:若超过起征点最多达到1500,最多需要交45的税
若超过起征点最多达到4500,最多需要交345的税
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner scan=new Scanner(System.in);
int s=scan.nextInt();
if(s<=3500)
{
System.out.println(s);
}
else if(s<=4955)//1500 3%
{
s-=3500;
//1455
//x-(x*0.03)=1455
//9.97x=1455;
//x=1455/0.97;
double ans=s/0.97;
System.out.println((int)ans+3500);
}
else if(s<=7655)//4500 10%
{
s-=3500;
//x-(x1+(x-1500)*0.1)=s
s-=150;
s+=45;
double ans=s/0.9;
System.out.println((int)ans+3500);
}
else if(s<=11255)//9000 20%
{
s-=3500;
//x-(x1+x2+(x-4500)*0.2=s;
s+=45;
s+=300;
s-=900;
double ans=s/0.8;
System.out.println((int)ans+3500);
}
else if(s<=30755)//35000
{
s-=3500;
//x-(x1+x2+x3+(x-9000)*0.25=s;
s+=1245;
s-=2250;
double ans=s/0.75;
System.out.println((int)ans+3500);
}
else if(s<=44755)//55000
{
s-=3500;
//x-(x1+x2+x3+x4+(x-35000)*0.3=s;
s+=7745;
s-=10500;
double ans=s/0.7;
System.out.println((int)ans+3500);
}
else if(s<=61005)//80000
{
s-=3500;
s+=13745;
s-=19250;
double ans=s/0.65;
System.out.println((int)ans+3500);
}
else
{
s-=3500;
s+=22495;
s-=36000;
double ans=s/0.55;
ans=Math.ceil(ans);
System.out.println((int)ans+3500);
}
scan.close();
}
}