记录编号 |
31795 |
评测结果 |
AAAAA |
题目名称 |
[NOI 1998]个人所得税 |
最终得分 |
100 |
用户昵称 |
Czb。 |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.000 s |
提交时间 |
2011-11-03 21:39:52 |
内存使用 |
0.00 MiB |
显示代码纯文本
#include<stdio.h>
#include<string.h>
struct aaa
{
int s[13];
}a[50001];
int n;
char c[10];
double ans,x;
double min(double a,double b)
{
return a<b?a:b;
}
int main()
{
freopen("personaltax.in","r",stdin);
freopen("personaltax.out","w",stdout);
int i,j,k,m;
scanf("%d",&n);
scanf("%s",&c);
while(c[0]!='#')
{
scanf("%d%d/%*d%lf\n",&k,&m,&x);
if(c[0]=='P')
{
a[k].s[m]+=x;
}
else
{
if(x<800)
{
x=0;
}
else if(x<=4000)
{
x-=800;
}
else
{
x=x*0.8;
}
ans+=min(x,20000.0)*0.2;
if(x>20000)
{
ans+=min(x-20000,30000.0)*0.3;
}
if(x>50000)
{
ans+=(x-50000)*0.4;
}
}
scanf("%s",&c);
}
for(i=1;i<=n;i++)
{
for(j=1;j<=12;j++)
{
if(a[i].s[j]<800)
{
a[i].s[j]=0;
}
else
{
a[i].s[j]-=800;
}
ans+=min(double(a[i].s[j]),500.0)*0.05;
if(a[i].s[j]>500)
{
ans+=min(double(a[i].s[j])-500,1500.0)*0.1;
}
if(a[i].s[j]>2000)
{
ans+=min(double(a[i].s[j])-2000,3000.0)*0.15;
}
if(a[i].s[j]>5000)
{
ans+=min(double(a[i].s[j])-5000,15000.0)*0.2;
}
if(a[i].s[j]>20000)
{
ans+=min(double(a[i].s[j])-20000,20000.0)*0.25;
}
if(a[i].s[j]>40000)
{
ans+=min(double(a[i].s[j])-40000,20000.0)*0.3;
}
if(a[i].s[j]>60000)
{
ans+=min(double(a[i].s[j])-60000,20000.0)*0.35;
}
if(a[i].s[j]>80000)
{
ans+=min(double(a[i].s[j])-80000,20000.0)*0.4;
}
if(a[i].s[j]>100000)
{
ans+=(double(a[i].s[j])-100000)*0.45;
}
}
}
printf("%.2lf\n",ans);
return 0;
}