记录编号 79217 评测结果 AAAAA
题目名称 [NOI 1998]个人所得税 最终得分 100
用户昵称 GravatarspadeK 是否通过 通过
代码语言 C 运行时间 0.000 s
提交时间 2013-11-05 10:52:13 内存使用 0.00 MiB
显示代码纯文本
#include<stdio.h>
 
char t[10];
int M,Mi,money,a[50001][13],MM,DD;  
double sum=0; 
 
 double Paysuan(int money)
{
	double shui=0;
	if (money>0)
	{
		if (0<money&&money<500)
			shui+=money*0.05;else
				shui+=500*0.05;
	}
	if (money>500)
	{
		if (500<money&&money<=2000)
			shui+=(money-500)*0.1;else
				shui+=1500*0.1;
	}	
	if (money>2000)
	{
		if (2000<money&&money<=5000)
			shui+=(money-2000)*0.15;else
				shui+=3000*0.15;
	}
	if (money>5000)
	{
		if (5000<money&&money<=20000)
			shui+=(money-5000)*0.2;else
				shui+=15000*0.2;
	}
	if (money>20000)
	{
		if (20000<money&&money<=40000)
			shui+=(money-20000)*0.25;else
				shui+=20000*0.25;
	}
	if (money>40000)
	{
		if (40000<money&&money<=60000)
			shui+=(money-40000)*0.3;else
				shui+=20000*0.3;
	}
	if (money>60000)
	{
		if (60000<money&&money<=80000)
			shui+=(money-60000)*0.35;else
				shui+=20000*0.35;
	}
	if (money>80000)
	{
		if (80000<money&&money<=100000)
			shui+=(money-80000)*0.4;else
				shui+=20000*0.4;
	}
	if (money>100000) shui+=(money-100000)*0.45;
	return shui;
}

double Incomsuan(double money)
{
	double shui=0;
	if (money>0)
	{
		if (0<money&&money<=20000)
			shui+=money*0.2;
		else
			shui+=20000*0.2;
	}
	if (money>20000)
	{
		if (20000<money&&money<=50000)
			shui+=(money-20000)*0.3;
		else
			shui+=30000*0.3;
	}
	if (money>50000)
		shui+=(money-50000)*0.4;
	return shui;
}
 
main()
{
    int i,j;  
    freopen("personaltax.in","r",stdin);
	freopen("personaltax.out","w",stdout);  
    scanf("%d",&M);
    for (i=1;i<=M;i++)
		for (j=1;j<=12;j++) a[i][j]=0;
    scanf("%s",t);
    while(t[0]!='#')
    {
        scanf("%d",&Mi);                  
        if(t[0]=='P')
        {
           scanf("%d/%d",&MM,&DD);
           scanf("%d",&money);
           a[Mi][MM]+=money;
        }                         
        else
        {
           scanf("%d/%d",&MM,&DD);
           scanf("%d",&money);
           if(money<=4000) 
             sum+=Incomsuan(money-800);
           if(money>4000) 
             sum+=Incomsuan(money*0.8);
        }
     scanf("%s",t);                        
    }      
    for(i=1;i<=M;i++)
		for(j=1;j<=12;j++) 
           sum+=Paysuan(a[i][j]-800);
    printf("%.2f",sum);
}