记录编号 | 80105 | 评测结果 | AAAAA | ||
---|---|---|---|---|---|
题目名称 | [NOI 1998]个人所得税 | 最终得分 | 100 | ||
用户昵称 | 是否通过 | 通过 | |||
代码语言 | C++ | 运行时间 | 0.005 s | ||
提交时间 | 2013-11-06 19:22:31 | 内存使用 | 5.27 MiB | ||
#include <fstream> #include <string> #include <iomanip> using namespace std; ifstream fin("personaltax.in"); ofstream fout("personaltax.out"); double f[50001][13]; int n; double ans=0; double js1(double a) { if(a<=0) return 0; double counter=0; double temp=a; if(a<=500) return a*0.05; else counter+=500*0.05; if(a<=2000) return counter+(a-500)*0.1; else counter+=1500*0.1; if(a<=5000) return counter+=(a-2000)*0.15; else counter+=3000*0.15; if(a<=20000) return counter+=(a-5000)*0.2; else counter+=15000*0.2; if(a<=40000) return counter+=(a-20000)*0.25; else counter+=20000*0.25; if(a<=60000) return counter+=(a-40000)*0.3; else counter+=20000*0.3; if(a<=80000) return counter+=(a-60000)*0.35; else counter+=20000*0.35; if(a<=100000) return counter+=(a-80000)*0.4; else counter+=20000*0.4; if(a>100000) return counter+=(a-100000)*0.45; } double js2(double a) { if(a<=0) return 0; double counter=0; if(a<=20000) return a*0.2; else counter+=20000*0.2; if(a<=50000) return counter+=(a-20000)*0.3; else counter+=30000*0.3; if(a>50000) return counter+=(a-50000)*0.4; } int pow(int x,int y) { int temp=1; int i; for(i=1;i<=y;i++) temp=temp*x; return temp; } int zh(string A) { int LA=A.length(); int i; int K; int temp=0; for(i=LA-1;i>=0;i--) { K=pow(10,LA-i-1); temp+=(int(A[i])-48)*K; } return temp; } int main() { fin>>n; int temp; int mouth; string New=""; double tot; string a,b,c,d; int i,j; while(!fin.eof()) { fin>>a>>b>>c>>d; if(a[0]=='#') break; if(a[0]=='P') { temp=zh(b); New+=c[0]; if(c[1]!='/') New+=c[1]; mouth=zh(New); New=""; tot=zh(d); f[temp][mouth]+=tot; } else { tot=zh(d); if(tot<=4000) tot=js2(tot-800); else tot=js2(tot*0.8); ans+=tot; } } for(i=1;i<=n;i++) for(j=1;j<=12;j++) { ans+=js1(f[i][j]-800); } fout<<setiosflags(ios::fixed)<<setprecision(2)<<ans<<endl; fin.close(); fout.close(); return 0; }