记录编号 |
15439 |
评测结果 |
AAAAA |
题目名称 |
[NOI 1998]个人所得税 |
最终得分 |
100 |
用户昵称 |
.Xmz |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.012 s |
提交时间 |
2009-11-13 08:13:30 |
内存使用 |
2.40 MiB |
显示代码纯文本
program xmz;
var
f1,f2:text;
x:array[1..50000,1..12]of longint;
n,a,b,tx,ty,tz:longint;
s:real;
st,stt:char;
procedure ycx(nn:real);
begin
if nn<=4000 then nn:=nn-800 else nn:=nn*0.8;
if nn<=20000 then s:=s+nn*0.2
else
begin
s:=s+20000*0.2;
nn:=nn-20000;
if nn<=30000 then s:=s+nn*0.3
else
begin
s:=s+30000*0.3;
nn:=nn-30000;
s:=s+nn*0.4;
end;
end;
end;
procedure ys(nn:real);
begin
nn:=nn-800;
if nn<=500 then s:=s+nn*0.05
else
begin
s:=s+500*0.05;
nn:=nn-500;
if nn<=1500 then s:=s+nn*0.1
else
begin
s:=s+1500*0.1;
nn:=nn-1500;
if nn<=3000 then s:=s+nn*0.15
else
begin
s:=s+3000*0.15;
nn:=nn-3000;
if nn<=15000 then s:=s+nn*0.2
else
begin
s:=s+15000*0.2;
nn:=nn-15000;
if nn<=20000 then s:=s+nn*0.25
else
begin
s:=s+20000*0.25;
nn:=nn-20000;
if nn<=20000 then s:=s+nn*0.3
else
begin
s:=s+20000*0.3;
nn:=nn-20000;
if nn<=20000 then s:=s+nn*0.35
else
begin
s:=s+20000*0.35;
nn:=nn-20000;
if nn<=20000 then s:=s+nn*0.4
else
begin
s:=s+20000*0.4;
nn:=nn-20000;
s:=s+nn*0.45;
end;
end;
end;
end;
end;
end;
end;
end;
end;
begin
assign(f1,'personaltax.in');assign(f2,'personaltax.out');
reset(f1);rewrite(f2);
readln(f1,n);
read(f1,st);
while st<>'#' do
begin
if st='P' then while stt<>'Y' do read(f1,stt);
if st='I' then while stt<>'E' do read(f1,stt);
read(f1,tx);
repeat read(f1,stt);until (stt>='0')and(stt<='9');
ty:=0;
ty:=ty+ord(stt)-48;
read(f1,stt);
if stt<>'/' then begin ty:=ty*10;ty:=ty+ord(stt)-48;end;
while stt<>' ' do read(f1,stt);
readln(f1,tz);
if st='P' then inc(x[tx,ty],tz);
if st='I' then if tz>800 then ycx(tz);
read(f1,st);
end;
for a:=1 to n do
for b:=1 to 12 do
if x[a,b]>800 then ys(x[a,b]);
writeln(f2,s:0:2);
close(f1);close(f2);
end.