记录编号 575188 评测结果 AAAAA
题目名称 [NOI 1998]个人所得税 最终得分 100
用户昵称 GravatarSkloud 是否通过 通过
代码语言 C++ 运行时间 0.000 s
提交时间 2022-09-07 19:11:25 内存使用 0.00 MiB
显示代码纯文本
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
using namespace std;
int m,pa[50005][20],w,x;
int li[50005];
int mon,day;
long double ans;
string s;
double sp(int a)
{
    double x=a,t=0;
    x-=800;
    if(x>100000) t+=(x-100000)*0.45,x=100000;
    if(x>80000) t+=(x-80000)*0.40,x=80000;
    if(x>60000) t+=(x-60000)*0.35,x=60000;
    if(x>40000) t+=(x-40000)*0.30,x=40000;
    if(x>20000) t+=(x-20000)*0.25,x=20000;
    if(x>5000) t+=(x-5000)*0.20,x=5000;
    if(x>2000) t+=(x-2000)*0.15,x=2000;
    if(x>500) t+=(x-500)*0.10,x=500;
    if(x>0) t+=x*0.05;
    return t;
}
double si(int a)
{
    double x=a,t=0;
    if(x<=4000) x-=800;
    else x=x*0.8;
    if(x>50000) t+=(x-50000)*0.40,x=50000;
    if(x>20000) t+=(x-20000)*0.30,x=20000;
    if(x>0) t+=x*0.20;
    return t;
}
int main()
{
    freopen("personaltax.in","r",stdin);
    freopen("personaltax.out","w",stdout);
    cin>>m;
    while(cin>>s,s[0]!='#')
    {
        scanf("%d %d/%d %d",&x,&mon,&day,&w);
        if(s[0]=='P') pa[x][mon]+=w;
        else if(s[0]=='I')
             ans+=si(w);
    }
    x=0;
    for(int i=1;i<=m;i++)
    {
        for(int j=1;j<=12;j++)
        {
            ans+=sp(pa[i][j]);
        }
    }
    cout<<fixed<<setprecision(2)<<ans;
}