比赛 20111102 评测结果 AAAAW
题目名称 个人所得税 最终得分 80
用户昵称 TBK 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2011-11-02 20:16:50
显示代码纯文本
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iomanip>
using namespace std;      
int a,b,c,r[9]={5,10,15,20,25,30,35,40,45},k[3]={20,30,40};
string str;
double l,m,s=0,t[50001][13]={0};
int main(void)      
{         
    freopen("personaltax.in","r",stdin);      
    freopen("personaltax.out","w",stdout);       
    scanf("%d",&a);   
	for (;;)
	{
		cin>>str;
		if (str=="#") break;
		if (str=="PAY")
		{
			cin>>b>>str>>l;
			if (str[0]=='1')
			{
				if (str[1]=='/') c=1;
					else c=10+str[1]-'0';
			}
				else c=str[0]-'0';
			t[b][c]+=l;
		}
			else
			{
				cin>>str>>str>>l;
				if ((l>800)&&(l<=4000))
				{
					l-=800;
					l*=k[0];
					s+=(double)(l/100);
					continue;
				}
				if (l>4000)
				{
					m=(double)l/5;
					l-=m;
					if (l<=20000)
					{
						l*=k[0];
						s+=(double)(l/100);
						continue;
					}
					l-=20000;
					s+=4000;
					if (l<=30000)
					{
						l*=k[1];
						s+=(double)(l/100);
						continue;
					}
					l-=30000;
					s+=90000;
					if (l>0)
					{
						l*=k[2];
						s+=(double)(l/100);
						continue;
					}
				}
			}
	}
	for (b=1;b<=a;b++)
		for (c=1;c<=12;c++)
			if (t[b][c]!=0)
			{
				if (t[b][c]>800)
				{
					t[b][c]-=800;
					if (t[b][c]<=500) 
					{
						t[b][c]*=r[0];
						s+=(double)(t[b][c]/100);
						continue;
					}
					s+=25;
					t[b][c]-=500;
					if (t[b][c]<=1500)
					{
						t[b][c]*=r[1];
						s+=(double)(t[b][c]/100);
						continue;
					}
					s+=150;
					t[b][c]-=1500;
					if (t[b][c]<=3000)
					{
						t[b][c]*=r[2];
						s+=(double)(t[b][c]/100);
						continue;
					}
					s+=450;
					t[b][c]-=3000;
					if (t[b][c]<=15000)
					{
						t[b][c]*=r[3];
						s+=(double)(t[b][c]/100);
						continue;
					}
					s+=3000;
					t[b][c]-=15000;
					if (t[b][c]<=20000)
					{
						t[b][c]*=r[4];
						s+=(double)(t[b][c]/100);
						continue;
					}
					s+=5000;
					t[b][c]-=20000;
					if (t[b][c]<=20000)
					{
						t[b][c]*=r[5];
						s+=(double)(t[b][c]/100);
						continue;
					}	
					s+=6000;
					t[b][c]-=20000;
					if (t[b][c]<=20000)
					{
						t[b][c]*=r[6];
						s+=(double)(t[b][c]/100);
						continue;
					}
					s+=7000;
					t[b][c]-=20000;
					if (t[b][c]<=20000)
					{
						t[b][c]*=r[7];
						s+=(double)(t[b][c]/100);
						continue;
					}
					s+=8000;
					t[b][c]-=20000;
					if (t[b][c]>0)
					{
						t[b][c]*=r[8];
						s+=(double)(t[b][c]/100);
						continue;
					}
				}
			}
	cout<<setiosflags(ios::fixed)<<setprecision(2)<<s;
    fclose(stdin);
	fclose(stdout);
    return 0;     
}