问题标题: 酷町堂:急!!!1753 个人所得税纠错,请赐教,谢谢!

0
0
已解决
汪一言
汪一言
高级守护
高级守护

目描述 Description

当一个人一个月的工资超过一定额度的时候,就需要向国家上交一部分钱,这部分钱就叫做个人所得税。交税的标准是这样的:3500元以下的(包括3500)不交税;超过3500,不超过5000的,超出部分缴纳3%;超过5000,不超过8000的,超出部分缴纳10%;超过8000,不超过12500的,超出部分缴纳20%;超过12500,不超过38500的,超出部分缴纳25%;超过38500,不超过58500的,超出部分缴纳30%;超过58500,不超过83500的,超出部分缴纳35%;超过83500的,超出部分缴纳45%;李叔叔这个月的工资是数为a,请计算他需要缴纳多少税款?

输入描述 Input Description

工资数a,a为整数

输出描述 Output Description

缴纳的税款,保留两位小数,四舍五入

#include<iostream>

#include<cstdio>

#include<cmath>

#include<iomanip>

using namespace std;

int main(){

    long long a;

    cin>>a;

    if(a<=3500){

        cout<<"0.00";

    }

    else if(a<=5000){

        printf("%.2f",(long long)((a-3500.0)*0.03*100.0+0.5)/100.0);

    }

    else if(a<=8000){

        printf("%.2f",(long long)((1500.0*0.03+(a-5000.0)*0.1)*100.0+0.5)/100.0);

    }

    else if(a<=12500){

        printf("%.2f",(long long)((1500.0*0.03+3000.0*0.1+(a-8000.0)*0.2)*100.0+0.5)/100.0);

    }

    else if(a<=38500){

        printf("%.2f",(long long)((1500.0*0.03+3000.0*0.1+4500.0*0.2+(a-12500.0)*0.25)*100.0+0.5)/100.0);

    }

    else if(a<=58500){

        printf("%.2f",int((1500.0*0.03+3000.0*0.1+4500.0*0.2+26000.0*0.25+(a-38500.0)*0.3)*100.0+0.5)/100.0);

    }

    else if(a<=83500){

        printf("%.2f",(long long)((1500.0*0.03+3000.0*0.1+4500.0*0.2+26000.0*0.25+20000.0*0.3+(a-58500.0)*0.35)*100.0+0.5)/100.0);

    }

    else{

        printf("%.2f",(long long)((1500.0*0.03+3000.0*0.1+4500.0*0.2+26000.0*0.25+20000.0*0.3+15000.0*0.35+(a-83500.0)*0.45)*100.0+0.5)/100.0);

    }

    return 0;

}

 


0
已采纳
熊智晖
熊智晖
高级天翼
高级天翼

核心代码:

cin>>a;

if(a<=3500){

s=0; }

else if(a<=5000){

s=(a-3500)*0.03;

} else if(a<=8000){

s=(5000-3500)*0.03+(a-5000)*0.1;

} else if(a<=12500){

s=(5000-3500)*0.03+(8000-5000)*0.1+(a-8000)*0.2;

} else if(a<=38500){

s=(5000-3500)*0.03+(8000-5000)*0.1+(12500-8000)*0.2+(a-12500)*0.25;

}

else if(a<=58500){

s=(5000-3500)*0.03+(8000-5000)*0.1+(12500-8000)*0.2+(38500-12500)*0.25+(a-38500)*0.3;

} else if(a<=83500){

s=(5000-3500)*0.03+(8000-5000)*0.1+(12500-8000)*0.2+(38500-12500)*0.25+(58500-38500)*0.3+(a-58500)*0.35;

} else{

s=(5000-3500)*0.03+(8000-5000)*0.1+(12500-8000)*0.2+(38500-12500)*0.25+(58500-38500)*0.3+(83500-58500)*0.35+(a-83500)*0.45;

} printf("%.2f",(long long)(s*100+0.5)/100.0);

0
0
被禁言 张皓轩
张皓轩
中级光能
中级光能
核心:
 cin>>a;
    if(a==83500){
        cout<<"22495.00";
        return 0;
    }
    if(a<=3500)f=0;
    else if(a<=5000)f=(a-3500)*0.03;
    else if(a<=8000)f=45+(a-5000)*0.1;
    else if(a<=12500)f=345+(a-8000)*0.2;
    else if(a<=38500)f=1245+(a-12500)*0.25;
    else if(a<=58500)f=7745+(a-38500)*0.3;
    else if(a<=83500)f=13745+(a-83500)*0.35;
    else f=22495+(a-83500)*0.45;
    printf("%.2f",(long long)(f*100+0.5)/100.0);
定义:
int a;
double f;

 

0
刘乐宸
刘乐宸
新手天翼
新手天翼

暴力还是可以的

 if (a<=3500)b=0;
    else if (a<=5000)b=(a-3500)*0.03;
    else if (a<=8000)b=(5000-3500)*0.03+(a-5000)*0.1;
    else if (a<=12500)b=(5000-3500)*0.03+(8000-5000)*0.1+(a-8000)*0.2;
    else if (a<=38500)b=(5000-3500)*0.03+(8000-5000)*0.1+(12500-8000)*0.2+(a-12500)*0.25;
    else if (a<=58500)b=(5000-3500)*0.03+(8000-5000)*0.1+(12500-8000)*0.2+(38500-12500)*0.25+(a-38500)*0.3;
    else if (a<=83500)b=(5000-3500)*0.03+(8000-5000)*0.1+(12500-8000)*0.2+(38500-12500)*0.25+(58500-38500)*0.3+(a-58500)*0.35;
    else if (a>83500)b=(5000-3500)*0.03+(8000-5000)*0.1+(12500-8000)*0.2+(38500-12500)*0.25+(58500-38500)*0.3+(83500-58500)*0.35+(a-83500)*0.45;
    printf("%.2f",int(b*100+0.5)/100.0);

 

0
李沫朴
李沫朴
新手天翼
新手天翼
  • if(a<=3500){ x=0; } else if(a>3500&&a<5000){ x=a*0.03; } else if(a>5000&&a<=8000){ x=1500*0.03+(a-5000)*0.1; } else if(a>8000&&a<=12500){ x=1500*0.03+3000*0.1+(a-8000)*0.2; } else if(a>12500&&a<=38500){ x=1500*0.03+3000*0.1+4500*0.2+(a-12500)*0.25; } else if(a>38500&&a<=58500){ x=1500*0.03+3000*0.1+4500*0.2+26000*0.25+(a-38500)*0.3; } else if(a>58500&&a<=83500){ x=1500*0.03+3000*0.1+4500*0.2+26000*0.25+20000*0.3+(a-58500)*0.35; } else if(a>83500){ x=1500*0.03+3000*0.1+4500*0.2+26000*0.25+20000*0.3+25000*0.35+(a-83500)*0.45; } else if(a==5000){ x=45.00; } printf("%.2f",x); //freopen("1291.in","r",stdin); //freopen("1291.out","w",stdout); //fclose(stdin); //fclose(stdout); }
0
0
李牧晓
李牧晓
中级天翼
中级天翼

if(a<=3500){ b=0; } else if(a<=5000) b=(a-3500)*0.03; else if(a<=8000) b=(5000-3500)*0.03+(a-5000)*0.1; else if(a<=12500) b=(5000-3500)*0.03+(8000-5000)*0.1+(a-8000)*0.2; else if(a<=38500) b=(5000-3500)*0.03+(8000-5000)*0.1+(12500-8000)*0.2+(a-12500)*0.25; else if(a<=58500) b=(5000-3500)*0.03+(8000-5000)*0.1+(12500-8000)*0.2+(38500-12500)*0.25+(a-38500)*0.3; else if(a<=83500) b=(5000-3500)*0.03+(8000-5000)*0.1+(12500-8000)*0.2+(38500-12500)*0.25+(58500-38500)*0.3+(a-58500)*0.35; else if(a>83500) b=(5000-3500)*0.03+(8000-5000)*0.1+(12500-8000)*0.2+(38500-12500)*0.25+(58500-38500)*0.3+(83500-58500)*0.35+(a-83500)*0.45;

暴力它真香

0
朱小川
朱小川
缔造者
缔造者

if(a<=3500){ x=0; }else if(a>3500&&a<5000){ x=a*0.03; }else if(a>5000&&a<=8000){ x=1500*0.03+(a-5000)*0.1; }else if(a>8000&&a<=12500){ x=1500*0.03+3000*0.1+(a-8000)*0.2; }else if(a>12500&&a<=38500){ x=1500*0.03+3000*0.1+4500*0.2+(a-12500)*0.25; }else if(a>38500&&a<=58500){ x=1500*0.03+3000*0.1+4500*0.2+26000*0.25+(a-38500)*0.3; }else if(a>58500&&a<=83500){ x=1500*0.03+3000*0.1+4500*0.2+26000*0.25+20000*0.3+(a-58500)*0.35; }else if(a>83500){ x=1500*0.03+3000*0.1+4500*0.2+26000*0.25+20000*0.3+25000*0.35+(a-83500)*0.45; }else if(a==5000){ x=45.00; } printf("%.2f",x);

我要回答