比赛 |
20091112练习 |
评测结果 |
AWWWW |
题目名称 |
个人所得税 |
最终得分 |
20 |
用户昵称 |
bly1991 |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2009-11-12 11:43:08 |
显示代码纯文本
program bly(intput,output);
var
pay:array[1..50000,1..12] of int64;
st,st1,st2,st0:string;
n,mark,code,month,x:longint;
m:int64;
i,j:longint;
ans:real;
f1,f2:text;
function g(money:int64):real;
var
i0:integer;
f:array[1..9] of longint;
begin
for i0:=1 to 9 do f[i0]:=0;
g:=0;
money:=money-800;
if money>=500 then f[1]:=500
else f[1]:=money;
if money>=2000 then f[2]:=1500
else f[2]:=money-500;
if money>=5000 then f[3]:=3000
else f[3]:=money-2000;
if money>=20000 then f[4]:=20000
else f[4]:=money-5000;
if money>=40000 then f[5]:=40000
else f[5]:=money-20000;
if money>=60000 then f[6]:=60000
else f[6]:=money-40000;
if money>=80000 then f[7]:=80000
else f[7]:=money-60000;
if money>=100000 then begin
f[8]:=100000;
f[9]:=money-100000;
end
else f[8]:=money-80000;
for i0:=1 to 9 do begin
if f[i0]<0 then f[i0]:=0;
end;
g:=f[1]*0.05+f[2]*0.1+f[3]*0.15+f[4]*0.2+f[5]*0.25+f[6]*0.3+f[7]*0.35+f[8]*0.4+f[9]*0.45;
end;
function t(money:int64):real;
var
f:array[1..3] of real;
mm:real;
i0:integer;
begin
for i0:=1 to 3 do f[i0]:=0;
t:=0;
if money<=4000 then mm:=money-800
else mm:=money*0.8;
if mm>=20000 then f[1]:=20000
else f[1]:=mm;
if mm>=50000 then begin
f[2]:=30000;
f[3]:=mm-50000;
end
else f[2]:=mm-20000;
for i0:=1 to 3 do begin
if f[i0]<0 then f[i0]:=0;
end;
t:=f[1]*0.2+f[2]*0.3+f[3]*0.4;
end;
begin
for i:=1 to 5000 do
for j:=1 to 12 do
pay[i,j]:=0;
ans:=0;
assign(f1,'personaltax.in');
reset(f1);
readln(f1,n);
repeat
readln(f1,st);
if st<>'#' then begin
if st[4]=' ' then st1:='PAY'
else st1:='INCOME';
for j:=1 to 3 do begin
i:=0;
repeat inc(i); val(st[i],x,code) until code=0;
delete(st,1,i-1);
if j=1 then begin
st0:=copy(st,1,pos(' ',st)-1);
val(st0,mark,code);
delete(st,1,pos(' ',st));
end;
if j=2 then begin
st0:=copy(st,1,pos('/',st)-1);
val(st0,month,code);
delete(st,1,pos(' ',st));
end;
if j=3 then begin
if pos(' ',st)=0 then val(st,m,code)
else begin
st0:=copy(st,1,pos(' ',st)-1);
val(st0,m,code);
end;
end;
end;
if st1='PAY' then pay[mark,month]:=pay[mark,month]+m;
if st1='INCOME' then begin
if m>800 then ans:=ans+t(m);
end;
end
else begin
for i:=1 to n do begin
for j:=1 to 12 do begin
if (pay[i,j]<>0)and(pay[i,j]>800) then ans:=ans+g(pay[i,j]);
end;
end;
end;
until st='#';
assign(f2,'personaltax.out');
rewrite(f2);
writeln(f2,ans:0:2);
close(f2);
close(f1);
end.