比赛 |
20111102 |
评测结果 |
AAAAA |
题目名称 |
个人所得税 |
最终得分 |
100 |
用户昵称 |
临轩听雨ゐ |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2011-11-02 21:09:55 |
显示代码纯文本
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <cstring>
using namespace std;
int pay[50001][13];
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 pay1(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;
}
int main()
{
freopen ("personaltax.in","r",stdin);
freopen ("personaltax.out","w",stdout);
int m;
int i,j;
double ans=0;
string way,f;
int num,mon,y;
cin>>m;
while(m)
{
cin>>way;
if(way=="#") break;
else
{
cin>>num>>y>>f>>mon;
if(way=="INCOME") ans+=income(mon);
if(way=="PAY") pay[num][y]+=mon;
}
}
for (i=1;i<=m;i++)
{
for (j=1;j<=12;j++)
ans+=pay1(pay[i][j]);
}
printf("%.2lf",ans);
return 0;
}