记录编号 |
575099 |
评测结果 |
AAAAA |
题目名称 |
[NOI 1998]个人所得税 |
最终得分 |
100 |
用户昵称 |
在大街上倒立游泳 |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.000 s |
提交时间 |
2022-09-03 11:25:19 |
内存使用 |
0.00 MiB |
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
double mon[50005][13],m,sum;
double zj1(double x)
{
x-=800;
if(x<0) x=0;
if(x<=500) return x*0.05;
if(x<=2000) return 25+(x-500)*0.1;
if(x<=5000) return 175+(x-2000)*0.15;
if(x<=20000) return 625+(x-5000)*0.2;
if(x<=40000) return 3625+(x-20000)*0.25;
if(x<=60000) return 8625+(x-40000)*0.3;
if(x<=80000) return 14625+(x-60000)*0.35;
if(x<=100000) return 21625+(x-80000)*0.4;
return 29625+(x-100000)*0.45;
}
double zj2(double x)
{
if(x<=4000) x-=800;
else x-=0.2*x;
if(x<0) x=0;
if(x<=20000) return x*0.2;
if(x<=50000) return 4000+(x-20000)*0.3;
return 13000+(x-50000)*0.4;
}
double hesuan()
{
for(int i=1;i<=m;i++)
for(int j=1;j<=12;j++)
{
sum+=zj1(mon[i][j]);
}
return sum;
}
int main(){
freopen("personaltax.in","r",stdin);
freopen("personaltax.out","w",stdout);
cout<<setiosflags(ios::fixed)<<setprecision(2);
cin>>m;
string p_i,date;
int person,num;
while(1==1)
{
cin>>p_i;
if(p_i=="#"){
cout<<hesuan();
break;
}
if(p_i=="PAY")
{
cin>>person>>date>>num;
if(date[1]=='/')
{
mon[person][0+(date[0]-'0')]+=num;
}
if(date[2]=='/')
{
mon[person][10+(date[1]-'0')]+=num;
}
}
if(p_i=="INCOME")
{
cin>>person>>date>>num;
sum+=zj2(num);
}
}
return 0;
}