比赛 |
EYOI与SBOI开学欢乐赛2nd |
评测结果 |
AAAAW |
题目名称 |
个人所得税 |
最终得分 |
80 |
用户昵称 |
Tab↹ |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2022-09-02 20:46:31 |
显示代码纯文本
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main(void) {
ifstream fin("personaltax.in");
ofstream fout("personaltax.out");
int m;
fin >> m;
double** arr = new double*[m+1];
for(int i = 0; i <= m; ++i)
arr[i] = new double[13];
string info, date;
int num;
float val;
while(1) {
fin >> info;
switch(info[0]) {
case 'P':
fin >> num >> date >> val;
arr[num][stoi(date)] += val;
continue;
case 'I':
fin >> num >> date >> val;
if(val <= 4000)
val -= 800;
else
val *= 0.8;
if(val > 50000){
arr[num][0] += (val - 50000) * 0.4;
val = 50000;
}
if(20000 < val && val <= 50000){
arr[num][0] += (val - 20000) * 0.3;
val = 20000;
}
if(0 < val && val <= 20000){
arr[num][0] += val * 0.2;
}
continue;
default:
break;
}
break;
}
int cur;
for(int i = 1; i <= m; ++i) {
for(int j = 1; j <= 12; ++j) {
cur = arr[i][j] - 800;
if(cur > 100000){
arr[i][0] += (cur - 100000) * 0.45;
cur = 100000;
}
if(80000 < cur && cur <= 100000){
arr[i][0] += (cur - 80000) * 0.4;
cur = 80000;
}
if(60000 < cur && cur <= 80000){
arr[i][0] += (cur - 60000) * 0.35;
cur = 60000;
}
if(40000 < cur && cur <= 60000){
arr[i][0] += (cur - 40000) * 0.3;
cur = 40000;
}
if(20000 < cur && cur <= 40000){
arr[i][0] += (cur - 20000) * 0.25;
cur = 20000;
}
if(5000 < cur && cur <= 20000){
arr[i][0] += (cur - 5000) * 0.2;
cur = 5000;
}
if(2000 < cur && cur <= 5000){
arr[i][0] += (cur - 2000) * 0.15;
cur = 2000;
}
if(500 < cur && cur <= 2000){
arr[i][0] += (cur - 500) * 0.1;
cur = 500;
}
if(1 <= cur && cur <= 500){
arr[i][0] += cur * 0.05;
}
}
}
double sum = 0;
for(int i = 1; i <= m; ++i) {
sum += arr[i][0];
}
fout.flags(ios::fixed);
fout.precision(2);
fout << sum;
for(int i = 0; i <= m; ++i)
delete []arr[i];
delete []arr;
return 0;
}