比赛 EYOI与SBOI开学欢乐赛2nd 评测结果 AWWWW
题目名称 个人所得税 最终得分 20
用户昵称 今天作业写了没 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2022-09-02 21:36:01
显示代码纯文本
#include<bits/stdc++.h>
#define ll long long
using namespace std;
string s;
ll n,d,m,k,num;
double ans,l2[3]={0,2000,7000},l1[9]={0,25,125,375,1375,3375,6375,10375,15375};
double tax1[9]={0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45};
double tax2[3]={0.2,0.3,0.4};
struct staff
{
	double mo[13]={-800,-800,-800,-800,-800,-800,-800,-800,-800,-800,-800,-800,-800};
}p[50005];
inline void read(ll &x)
{
	x=0;
	char a;
	a=getchar();//a=g() 
	while(a<'0'||a>'9') a=getchar();
	while(a>='0'&&a<='9') 
	{
		x=(x<<3)+(x<<1)+(a^48);
		a=getchar();//a=g() 
	}
} 
ll at(double a)
{
	if(a<500) return 0;
	if(a<2000) return 1;
	if(a<5000) return 2;
	if(a<20000) return 3;
	if(a<40000) return 4;
	if(a<60000) return 5;
	if(a<80000) return 6;
	if(a<100000) return 7;
	return 8;
}
void pay(double a,ll b)
{
	ans+=a*tax1[b]-l1[b];
}
void income(double a,ll b)
{
	ans+=a*tax2[b]-l2[b]; 
}
void in()
{
	read(n);
	while(1)
	{
		cin>>s;
		if(!(s[0]-'#')) break;
		if(!(s[0]-'P'))
		{
			read(k);
			read(m);
			read(d);
			read(num);
			p[k].mo[m]+=num;
		}
		else
		{
			read(k);
			read(m);
			read(d);
			read(num);
			if(num<4000) num-=800;
			else num*=0.8;
			if(num<0) continue;
			if(num<20000) income(num,0);
			else if(num<50000) income(num,1);
			else income(num,2);
		}
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=12;j++) if(p[i].mo[j]>0) pay(p[i].mo[j],at(p[i].mo[j]));
	}
}
int main(){
	freopen("personaltax.in","r",stdin);
	freopen("personaltax.out","w",stdout);
	in();
	printf("%0.2lf",ans);
}