记录编号 463011 评测结果 AAAAA
题目名称 [NOI 1998]个人所得税 最终得分 100
用户昵称 Gravatar软软糖 是否通过 通过
代码语言 C++ 运行时间 0.000 s
提交时间 2017-10-23 18:59:30 内存使用 0.00 MiB
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
double msal(double s)
{
	s-=800;
	double ans=0;
	if(s<=0) return 0;
	if(s<=500)
	{
		ans+=s*5/100;
		return ans;
	}
	ans+=500*5/100;
	s-=500;
	if(s<=1500)
	{
		ans+=s*10/100;
		return ans;
	}
	ans+=1500*10/100;
	s-=1500;
	if(s<=3000)
	{
		ans+=s*15/100;
		return ans;
	}
	ans+=3000*15/100;
	s-=3000;
	if(s<=15000)
	{
		ans+=s*20/100;
		return ans;
	}
	ans+=15000*20/100;
	s-=15000;
	if(s<=20000)
	{
		ans+=s*25/100;
		return ans;
	}
	ans+=20000*25/100;
	s-=20000;
	if(s<=20000)
	{
		ans+=s*30/100;
		return ans;
	}
	ans+=20000*30/100;
	s-=20000;
	if(s<=20000)
	{
		ans+=s*35/100;
		return ans;
	}
	ans+=20000*35/100;
	s-=20000;
	if(s<=20000)
	{
		ans+=s*40/100;
		return ans;
	}
	ans+=20000*40/100;
	s-=20000;
	ans+=s*45/100;
	return ans;
}
double tsal(double s)
{
	if(s<=4000) s-=800;
	else s*=0.8;
	double ans=0;
	if(s<=0) return 0;
	if(s<=20000)
	{
		ans+=s*20/100;
		return ans;
	}
	ans+=20000*20/100;
	s-=20000;
	if(s<=30000)
	{
		ans+=s*30/100;
		return ans;
	}
	ans+=30000*30/100;
	s-=30000;
	ans+=s*40/100;
	return ans;
}
string str;
const int SIZEN=50001;
int n;
double mp[SIZEN][15]={0};
double ans[SIZEN]={0};
void work(void){
	scanf("%d",&n);
	int pos,mon,day;
	double sal;
	do{
		cin>>str;
		if(str=="#") break;
		if(str=="PAY")
		{
			scanf("%d%d",&pos,&mon);
			getchar();
			scanf("%d%lf",&day,&sal);
			mp[pos][mon]+=sal;
		}
		else
		{
			scanf("%d%d",&pos,&mon);
			getchar();
			scanf("%d%lf",&day,&sal);
			ans[pos]+=tsal(sal);
		}
	}
	while(str!="#");
	cout<<setiosflags(ios::fixed)<<setprecision(2);
	double sum=0;
	int i,j;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=12;j++)
		{
			ans[i]+=msal(mp[i][j]);
		}
		sum+=ans[i];
	}
	cout<<sum<<endl;
}
int main(){
	freopen("personaltax.in","r",stdin);
	freopen("personaltax.out","w",stdout);
	work();
	return 0;
}