比赛 |
20091112练习 |
评测结果 |
C |
题目名称 |
个人所得税 |
最终得分 |
0 |
用户昵称 |
SMXX |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2009-11-12 10:54:02 |
显示代码纯文本
program df;
var
F1,F2:text;
n,i,o,j,m,y,d,x:longint;
sum:extended;
a:array[1..50000,0..12] of longint;
s1,s:string;
function cm(x:longint):double ;
var i,j:double;
begin
if x>4000 then i:=x*0.80 else i:=x-800;
if i>50000 then begin j:=i-50000;cm:=cm+j*0.40;i:=50000;end;
if i>20000 then begin j:=i-20000; cm:=cm+j*0.30;i:=20000;end;
if i>0 then begin cm:=cm+i*0.20;end;
end;
procedure dd(r,y:longint);
var
i,j:longint;
begin
i:=a[r,y]-800;
if i>100000 then begin j:=i-100000;sum:=sum+j*0.45;i:=100000;end;
if i>80000 then begin j:=i-80000;sum:=sum+j*0.40;i:=80000;end;
if i>60000 then begin j:=i-60000;sum:=sum+j*0.35;i:=60000;end;
if i>40000 then begin j:=i-40000;sum:=sum+j*0.30;i:=40000;end;
if i>20000 then begin j:=i-20000;sum:=sum+j*0.25;i:=20000;end;
if i>5000 then begin j:=i-5000;sum:=sum+j*0.20;i:=5000;end;
if i>2000 then begin j:=i-2000;sum:=sum+j*0.15;i:=2000;end;
if i>500 then begin j:=i-500;sum:=sum+j*0.10;i:=500;end;
if i>0 then sum:=sum+i*0.05;
end;
begin
assign(f1,'personaltax.in');
assign(f2,'personaltax.out');
reset(f1);
rewrite(f2);
readln(f1,n);
sum:=0;
readln(f1,s);
while s[1]<>'#' do begin
if s[1]='P'then begin
delete(s,1,pos(' ',s));
s1:=copy(s,1,pos(' ',s)-1);
val(s1,m,o);
delete(s,1,pos(' ',s));
s1:=copy(s,1,pos('/',s)-1);
val(s1,y,o);
delete(s,1,pos(' ',s));
val(s,x,o);
a[m,y]:=a[m,y]+x;a[m,0]:=1;
end;
if s[1]='I' then begin
delete(s,1,pos(' ',s));
s1:=copy(s,1,pos(' ',s)-1);
val(s1,m,o);
delete(s,1,pos(' ',s));
s1:=copy(s,1,pos('/',s)-1);
val(s1,y,o);
delete(s,1,pos(' ',s));
val(s,x,o);
sum:=sum+cm(x);
end;
readln(f1,s);
end;
for i:= 1to n do
if a[i,0]=1 then for j:=1 to 12 do dd(i,j);
writeln(f2,sum:0:2);
close(f1);
close(f2);
end.