比赛 |
20091112练习 |
评测结果 |
AAAAA |
题目名称 |
个人所得税 |
最终得分 |
100 |
用户昵称 |
maxiem |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2009-11-12 12:06:33 |
显示代码纯文本
program personaltax;
var
p:array [1..50000,0..12] of extended;
v,ans:extended;
i,j,no,code,mon,n:longint;
tmp:string;
begin
fillchar (p,sizeof(p),0);
assign (input,'personaltax.in');
reset (input);
readln (n);
repeat
readln (tmp);
tmp:=tmp+' ';
if tmp[1]='P' then begin
delete (tmp,1,3);
while tmp[1]=' ' do delete(tmp,1,1);
val(copy(tmp,1,pos(' ',tmp)-1),no,code);
delete (tmp,1,pos(' ',tmp));
while tmp[1]=' ' do delete(tmp,1,1);
val(copy(tmp,1,pos('/',tmp)-1),mon,code);
delete (tmp,1,pos(' ',tmp));
while tmp[1]=' ' do delete(tmp,1,1);
val(copy(tmp,1,pos(' ',tmp)-1),v,code);
p[no,mon]:=p[no,mon]+v;
end
else if tmp[1]='I' then begin
delete (tmp,1,7);
while tmp[1]=' ' do delete(tmp,1,1);
val(copy(tmp,1,pos(' ',tmp)-1),no,code);
delete (tmp,1,pos(' ',tmp));
while tmp[1]=' ' do delete(tmp,1,1);
val(copy(tmp,1,pos('/',tmp)-1),mon,code);
delete (tmp,1,pos(' ',tmp));
while tmp[1]=' ' do delete(tmp,1,1);
val(copy(tmp,1,pos(' ',tmp)-1),v,code);
if v<=4000 then v:=v-800 else v:=v*0.8;
if (v<=20000) and (v>0) then p[no,0]:=p[no,0]+v*0.2;
if (v>20000) and (v<=50000) then p[no,0]:=p[no,0]+4000+(v-20000)*0.3;
if (v>50000) then p[no,0]:=p[no,0]+13000+(v-50000)*0.4;
end;
until tmp[1]='#';
assign (output,'personaltax.out');
rewrite (output);
for i:=1 to n do begin
for j:=1 to 12 do begin
p[i,j]:=p[i,j]-800;
if (p[i,j]>0) then begin
if (p[i,j]<=500) then p[i,0]:=p[i,0]+p[i,j]*0.05 else p[i,0]:=p[i,0]+25;
p[i,j]:=p[i,j]-500;
if p[i,j]>0 then if (p[i,j]<=1500) then p[i,0]:=p[i,0]+p[i,j]*0.1 else p[i,0]:=p[i,0]+150;
p[i,j]:=p[i,j]-1500;
if p[i,j]>0 then if (p[i,j]<=3000) then p[i,0]:=p[i,0]+p[i,j]*0.15 else p[i,0]:=p[i,0]+450;
p[i,j]:=p[i,j]-3000;
if p[i,j]>0 then if (p[i,j]<=15000) then p[i,0]:=p[i,0]+p[i,j]*0.2 else p[i,0]:=p[i,0]+3000;
p[i,j]:=p[i,j]-15000;
if p[i,j]>0 then if (p[i,j]<=20000) then p[i,0]:=p[i,0]+p[i,j]*0.25 else p[i,0]:=p[i,0]+5000;
p[i,j]:=p[i,j]-20000;
if p[i,j]>0 then if (p[i,j]<=20000) then p[i,0]:=p[i,0]+p[i,j]*0.3 else p[i,0]:=p[i,0]+6000;
p[i,j]:=p[i,j]-20000;
if p[i,j]>0 then if (p[i,j]<=20000) then p[i,0]:=p[i,0]+p[i,j]*0.35 else p[i,0]:=p[i,0]+7000;
p[i,j]:=p[i,j]-20000;
if p[i,j]>0 then if (p[i,j]<=20000) then p[i,0]:=p[i,0]+p[i,j]*0.4 else p[i,0]:=p[i,0]+8000;
p[i,j]:=p[i,j]-20000;
if (p[i,j]>0) then p[i,0]:=p[i,0]+p[i,j]*0.45;
end;
end;
ans:=ans+p[i,0];
end;
writeln (ans:0:2);
close (output);
close (input);
end.