比赛 |
20111102 |
评测结果 |
AAAAA |
题目名称 |
个人所得税 |
最终得分 |
100 |
用户昵称 |
王者自由 |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2011-11-02 19:34:38 |
显示代码纯文本
#include <cstdio>
#include <cstring>
int m, n, mm, dd, y, p[5010][13], c[5010][13];
char s[10];
double k, w;
int main() {
freopen("personaltax.in", "r", stdin);
freopen("personaltax.out", "w", stdout);
scanf("%d\n", &m);
do {
scanf("%s", s);
if(s[0] == '#') break;
scanf("%d %d/%d %d\n", &n, &mm, &dd, &y);
if(strcmp(s, "PAY") == 0)
p[n][mm] += y;
else if(strcmp(s, "INCOME") == 0) {
k = y > 4000 ? y * 0.8 : y - 800;
if(k > 50000)
w += (k - 50000) * 0.40, k = 50000;
if(k > 20000)
w += (k - 20000) * 0.30, k = 20000;
if(k > 0)
w += (k - 0) * 0.20, k = 0;
}
} while(s[0] != '#');
for(int i=1; i<=m; i++)
for(int j=1; j<=12; j++) {
k = p[i][j] - 800;
if(k > 100000)
w += (k - 100000) * 0.45, k = 100000;
if(k > 80000)
w += (k - 80000) * 0.40, k = 80000;
if(k > 60000)
w += (k - 60000) * 0.35, k = 60000;
if(k > 40000)
w += (k - 40000) * 0.30, k = 40000;
if(k > 20000)
w += (k - 20000) * 0.25, k = 20000;
if(k > 5000)
w += (k - 5000) * 0.20, k = 5000;
if(k > 2000)
w += (k - 2000) * 0.15, k = 2000;
if(k > 500)
w += (k - 500) * 0.10, k = 500;
if(k > 0)
w += (k - 0) * 0.05, k = 0;
}
printf("%.2lf\n", w);
return 0;
}