记录编号 31709 评测结果 AAAAA
题目名称 [NOI 1998]个人所得税 最终得分 100
用户昵称 Gravatar苏轼 是否通过 通过
代码语言 C++ 运行时间 0.033 s
提交时间 2011-11-03 15:45:53 内存使用 6.03 MiB
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
double q[50010],answer=0;
struct hehe
{
	int zhong,ren,yue,ri;
	double qian;
}w[10000];
double f[50001][13];
int number,ji=-1,u[50010]={0};
void cal_I(int n);
void cal_P(int n);
int main()
{
	freopen ("personaltax.in","r",stdin);
	freopen ("personaltax.out","w",stdout);
	scanf("%d",&number);
	char s[7];
	while (cin>>s)
	{
		int lq;
		lq=strlen (s);
		if (s[0]=='#')
		{
			break;
		}
		ji++;
		if (lq==6)
		{
			w[ji].zhong=1;
			double a;
			cin>>a;
			w[ji].ren=a;
			cin>>a;
			w[ji].yue=a;
			scanf("%c^[/]",&s);
			cin>>a;
			w[ji].ri=a;
			cin>>a;
			w[ji].qian=a;
			double temp;
			temp=w[ji].qian;
			cal_I(w[ji].qian);
		}
		else
		{
			w[ji].zhong=0;
			double a;
			cin>>a;
			w[ji].ren=a;
			cin>>a;
			w[ji].yue=a;
			scanf("%c^[/]",&s);
			cin>>a;
			w[ji].ri=a;
			cin>>a;
			w[ji].qian=a;
			f[w[ji].ren][(int)w[ji].yue]+=w[ji].qian;
		}
	}
	for (int i=1;i<=number;i++)
	{
		for (int j=1;j<13;j++)
		{
			cal_P(f[i][j]);
		}
	}
	printf("%.2lf",answer);
	return 0;
}
void cal_P(int n)
{
	double paulinsider;
	paulinsider=n-800;
	if (paulinsider<0)
		paulinsider=0;
	if (paulinsider==0)
		return;
	/////////////////////
	if (paulinsider<=500)
	{
		answer+=paulinsider*0.05;
		paulinsider=0;
	}
	else
	{
		answer+=500*0.05;
		paulinsider-=500;
	}
	/////////////////////
	if (paulinsider<=1500)
	{
		answer+=paulinsider*0.1;
		paulinsider=0;
	}
	else
	{
		answer+=1500*0.1;
		paulinsider-=1500;
	}
	/////////////////////
	if (paulinsider<=3000)
	{
		answer+=paulinsider*0.15;
		paulinsider=0;
	}
	else
	{
		answer+=3000*0.15;
		paulinsider-=3000;
	}
	/////////////////////
	if (paulinsider<=15000)
	{
		answer+=paulinsider*0.2;
		paulinsider=0;
	}
	else
	{
		answer+=15000*0.2;
		paulinsider-=15000;
	}
	/////////////////////
	if (paulinsider<=20000)
	{
		answer+=paulinsider*0.25;
		paulinsider=0;
	}
	else
	{
		answer+=20000*0.25;
		paulinsider-=20000;
	}
	/////////////////////
	if (paulinsider<=20000)
	{
		answer+=paulinsider*0.3;
		paulinsider=0;
	}
	else
	{
		answer+=20000*0.3;
		paulinsider-=20000;
	}
	/////////////////////
	if (paulinsider<=20000)
	{
		answer+=paulinsider*0.35;
		paulinsider=0;
	}
	else
	{
		answer+=20000*0.35;
		paulinsider-=20000;
	}
	/////////////////////
	if (paulinsider<=20000)
	{
		answer+=paulinsider*0.4;
		paulinsider=0;
	}
	else
	{
		answer+=20000*0.4;
		paulinsider-=20000;
	}
	/////////////////////
	if (paulinsider>=0)
	{
		answer+=paulinsider*0.45;
		paulinsider=0;
	}
}
void cal_I(int n)
{
	double paulinsider;
	if (n<=4000)
	{
		paulinsider=n-800;
		if (paulinsider<0)
			paulinsider=0;
	}
	else
	{
		paulinsider=n*0.8;
	}
	if (paulinsider==0)
		return;
	/////////////////////
	if (paulinsider<=20000)
	{
		answer+=paulinsider*0.2;
		paulinsider=0;
	}
	else
	{
		answer+=20000*0.2;
		paulinsider-=20000;
	}
	/////////////////////
	if (paulinsider<=30000)
	{
		answer+=paulinsider*0.3;
		paulinsider=0;
	}
	else
	{
		answer+=30000*0.3;
		paulinsider-=30000;
	}
	/////////////////////
	if (paulinsider>=0)
	{
		answer+=paulinsider*0.4;
		paulinsider=0;
	}
}