比赛 EYOI与SBOI开学欢乐赛2nd 评测结果 AAAAA
题目名称 个人所得税 最终得分 100
用户昵称 ムラサメ 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2022-09-02 21:36:36
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
double income(int s){
	double w=s;
	if (w<=4000)
		w-=800;
	else
		w*=0.8;
	if (w<=0)
		return 0;
	else if (w<=20000)
		return w*0.2;
	else if (w<=50000)
		return 4000+(w-20000)*0.3;
	else
		return 4000+9000+(w-50000)*0.4;
}
double wage(int s){
	double w=s-800;
	if (w<=0)
		return 0;
	else if (w<=500)
		return w*0.05;
	else if (w<=2000)
		return 25+(w-500)*0.1;
	else if (w<=5000)
		return 25+150+(w-2000)*0.15;
	else if (w<=20000)
		return 25+150+450+(w-5000)*0.2;
	else if (w<=40000)
		return 25+150+450+3000+(w-20000)*0.25;
	else if (w<=60000)
		return 25+150+450+3000+5000+(w-40000)*0.3;
	else if (w<=80000)
		return 25+150+450+3000+5000+6000+(w-60000)*0.35;
	else if (w<=100000)
		return 25+150+450+3000+5000+6000+7000+(w-80000)*0.40;
	else
		return 25+150+450+3000+5000+6000+7000+8000+(w-100000)*0.45;
}
using namespace std;
int pm[50001][13],M;
double Total;
int main(){
	freopen("personaltax.in","r",stdin);
	freopen("personaltax.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	char c,ct[10];
	int i,j,id,month,t,s;
	scanf("%d",&M);
	Total=0;
	while(c!='#'){
		scanf("%s%d%d",ct,&id,&month);
		getchar();scanf("%d%d",&t,&s);
		if (ct[0]=='I')
			Total+=income(s);
		else
			pm[id][month]+=s;
		do c=getchar(); while (c==10 || c==13);
		ungetc(c,stdin);
	}
	for(i=1;i<=M;i++){
		for(j=1;j<=12;j++)
			Total+=wage(pm[i][j]);
	}
	printf("%.2lf\n",Total);
	return 0;
}