比赛 EYOI与SBOI开学欢乐赛2nd 评测结果 AAAWW
题目名称 个人所得税 最终得分 60
用户昵称 Skloud 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2022-09-02 21:32:31
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int m,pa[50005][20],w,x;
int in[10005][380],tot,li[50005];
int mon,day;
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')
        {
            if(li[x]==0)
            {
                  in[++tot][(mon-1)*31+day]+=w;
                li[x]=tot;
            }
              
            else in[li[x]][(mon-1)*31+day]+=w;
        } 
    }
    x=0;
    for(int i=1;i<=m;i++)
    {
        for(int j=1;j<=12;j++)
        {
            ans+=sp(pa[i][j]);
        }
        for(int j=1;j<=12;j++)
        {
            for(int k=1;k<=31;k++)
            {
                ans+=si(in[li[i]][(j-1)*31+k]);
            }
        }
    }
    printf("%.2lf\n",ans);
}