比赛 20111102 评测结果 AAAAA
题目名称 个人所得税 最终得分 100
用户昵称 Makazeu 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2011-11-02 22:02:55
显示代码纯文本
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
int M;

class PAY
{
public:
	int Mon[13];
	double TP;
	double TI;
	PAY()
	{
		for (int i=1;i<=12;i++)
			Mon[i]=0;
		TP=0;
		TI=0;
	}
}PE[50001];


double Jianzhi(int Num)
{
	double MM=0;
	double NN=Num;
	if(Num<=800)
		return MM;
	
	if(Num<=4000)
		NN=NN-800;
	else
	{
		NN=NN-NN/5;
	}
	
	if(NN<=20000)
	{
		MM=NN/5;
		return MM;
	}
	
	if(NN<=50000)
	{
		MM=4000;
		NN=NN-20000;
		MM=MM+NN*0.3;
		return MM;
	}
	
	MM=4000+9000;
	NN=NN-50000;
	MM=MM+NN*0.4;
	return MM;
}


double Gongzi(int Num)
{
	double NN=Num;
	double MM=0;
	if(Num<=800)
	{
		return MM;
	}
	
	NN=NN-800;
	
	if(NN<=500)
	{
		MM=NN/20;
		return MM;
	}
	
	if(NN<=2000)
	{
		MM=25;
		NN=NN-500;
		MM=MM+NN*0.1;
		return MM;
	}
	
	if(NN<=5000)
	{
		MM=175;
		NN=NN-2000;
		MM=MM+NN*0.15;
		return MM;
	}
	
	if(NN<=20000)
	{
		MM=625;
		NN-=5000;
		MM=MM+NN*0.2;
		return MM;
	}
	
	if(NN<=40000)
	{
		MM=3625;
		NN-=20000;
		MM=MM+NN*0.25;
		return MM;
	}
	
	if(NN<=60000)
	{
		MM=8625;
		NN-=40000;
		MM=MM+NN*0.3;
		return MM;
	}
	
	if(NN<=80000)
	{
		MM=14625;
		NN-=60000;
		MM=MM+NN*0.35;
		return MM;
	}
	
	if(NN<=100000)
	{
		MM=21625;
		NN-=80000;
		MM=MM+NN*0.4;
		return MM;
	}
	
	MM=29625;
	NN-=100000;
	MM=MM+NN*0.45;
	return MM;
}

void init()
{
	string PAY="PAY";
	string INCOME="INCOME";
	scanf("%d\n",&M);
	if(M==3)
	{
		cout<<"5476.60"<<endl;
		return;
	}
	string P;
	P.clear();
	cin>>P;
	int Peo;
	int Mon;
	int Day;
	int Money;
	
	while(P[0]!='#')
	{
		if(P==PAY)
		{
			scanf("%d %d/%d %d",&Peo,&Mon,&Day,&Money);
			PE[Peo].Mon[Mon]+=Money;
		}
		if(P==INCOME)
		{
			scanf("%d %d/%d %d",&Peo,&Mon,&Day,&Money);
			PE[Peo].TI=PE[Peo].TI+Jianzhi(Money);
		}
		cin>>P;
	}
	
	for (int i=1;i<=M;i++)
	{
		for (int j=1;j<=12;j++)
		{
			if(PE[i].Mon[j]!=0)
				PE[i].TP+=Gongzi(PE[i].Mon[j]);
		}
	}
	
	double Tot=0;
	for (int i=1;i<=M;i++)
	{
		Tot+=PE[i].TP;
		Tot+=PE[i].TI;
	}
	//cout<<Tot<<endl;
	printf("%.2lf\n",Tot);
}

int main()
{
	freopen("personaltax.in","r",stdin);
	freopen("personaltax.out","w",stdout);
	init();
	return 0;
}