比赛 EYOI与SBOI开学欢乐赛2nd 评测结果 AAAAA
题目名称 个人所得税 最终得分 100
用户昵称 ZRQ 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2022-09-02 21:01:59
显示代码纯文本
#include<iostream>
#include<cstdio>
using namespace std;
const int M=50005;
char str[10],tm[10];
int m,p[M][14];
double ans;
int getm()
{
	int res=tm[0]-'0';
	if(tm[1]!='/') res*=10,res+=tm[1]-'0'; 
	return res;
}
double income(double k)
{
	double res=0.0;
	if(k<=20000) res=(double)k*0.2;
	else if(k<=50000) res=4000.0+(double)(k-20000.0)*0.3;
	else res=13000.0+(double)(k-50000.0)*0.4;
	return res;
}
double pay(int k)
{
	double res=0.0;
	if(k<=500) res=(double)k*0.05;
	else if(k<=2000) res=25.0+(double)(k-500.0)*0.1;
	else if(k<=5000) res=175.0+(double)(k-2000.0)*0.15;
	else if(k<=20000) res=625.0+(double)(k-5000.0)*0.2;
	else if(k<=40000) res=3625.0+(double)(k-20000.0)*0.25;
	else if(k<=60000) res=8625.0+(double)(k-40000.0)*0.3;
	else if(k<=80000) res=14625.0+(double)(k-60000.0)*0.35;
	else if(k<=100000) res=21625.0+(double)(k-80000.0)*0.4;
	else if(k>100000) res=29625.0+(double)(k-100000.0)*0.45;
	return res;
}
int main()
{
	freopen("personaltax.in","r",stdin);
	freopen("personaltax.out","w",stdout);
	scanf("%d",&m);
	while(scanf("%s",str)&&str[0]!='#')
	{
		int id,k;
		scanf("%d%s%d",&id,tm,&k);
		if(str[0]=='P') p[id][getm()]+=k;
		else if(str[0]=='I'&&k>800)
		{
			if(k<=4000) ans+=income((double)k-800.0);
			else ans+=income((double)k*0.8);
		}
	}
	for(int i=1;i<=m;++i)
		for(int j=1;j<=12;++j)
			if(p[i][j]>800) ans+=pay(p[i][j]-800);
	printf("%.2lf",ans);
	return 0;
}