比赛 |
EYOI与SBOI开学欢乐赛2nd |
评测结果 |
AAAAA |
题目名称 |
个人所得税 |
最终得分 |
100 |
用户昵称 |
00000 |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2022-09-02 20:37:31 |
显示代码纯文本
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int m;
string a;
double ans;
int b[60000][20];
void cop(int x)
{
double s;
s=x-800;
if(s<=0) return;
if(s<=500)
{
ans+=s*0.05;
return;
}
s-=500;ans+=500*0.05;
if(s<=1500)
{
ans+=s*0.1;
return;
}
s-=1500;ans+=1500*0.1;
if(s<=3000)
{
ans+=s*0.15;
return;
}
s-=3000;ans+=3000*0.15;
if(s<=15000)
{
ans+=s*0.2;
return;
}
s-=15000;ans+=15000*0.2;
if(s<=20000)
{
ans+=s*0.25;
return;
}
s-=20000;ans+=20000*0.25;
if(s<=20000)
{
ans+=s*0.3;
return;
}
s-=20000;ans+=20000*0.3;
if(s<=20000)
{
ans+=s*0.35;
return;
}
s-=20000;ans+=20000*0.35;
if(s<=20000)
{
ans+=s*0.4;
return;
}
s-=20000;ans+=20000*0.4;
ans+=s*0.45;
}
void pay()
{
int n,x,z,my;
char y;
cin>>n>>x>>y>>z>>my;
b[n][x]+=my;
}
void ic()
{
int n,x,z,my;
char y;
cin>>n>>x>>y>>z>>my;
double s;
if(my<=4000) s=my-800;
else s=double(my*0.8);
if(s<=0) return;
if(s<=20000)
{
ans+=s*0.2;
return;
}
s-=20000;ans+=20000*0.2;
if(s<=30000)
{
ans+=s*0.3;
return;
}
s-=30000;ans+=30000*0.3;
ans+=s*0.4;
}
int main(){
freopen("personaltax.in","r",stdin);
freopen("personaltax.out","w",stdout);
cin>>m;
while(1)
{
cin>>a;
if(a=="#") break;
if(a=="PAY") pay();
if(a=="INCOME") ic();
}
for(int q=1;q<=m;q++)
{
for(int w=1;w<=12;w++)
{
cop(b[q][w]);
}
}
printf("%.2lf",ans);
return 0;
}