记录编号 79427 评测结果 AAAAA
题目名称 [NOI 1998]个人所得税 最终得分 100
用户昵称 GravatarC语言入门 是否通过 通过
代码语言 Pascal 运行时间 0.005 s
提交时间 2013-11-05 18:01:35 内存使用 4.74 MiB
显示代码纯文本
program o;
var
 m,num,pay,yf:int64;
 i,i1,t,j,i2:longint;
 k:real;
 s:string;
 p:array [1..50000,1..12] of int64;
 zs:real;
function min(a,b:real):real;
begin
 if a<=0 then  exit(0);
 if b<=0 then exit(0);
 if a>b then min:=b
        else min:=a;
end;
begin
assign (input,'personaltax.in');
assign (output,'personaltax.out');
reset (input);
rewrite (output);
 readln (m);
 while not eof do
  begin
   readln(s);
   if s='#' then break;
   s:=s+' ';
   if s[1]='P' then
    begin
    i2:=4;
     while s[i2]=' ' do
      inc(i2);
     for i:=i2 to length(s) do
      if s[i]=' ' then break;
      val(copy(s,i2,i-i2),num,t);
     for i1:=i+1 to length(s) do
      if s[i1]='/' then break;
      val(copy(s,i+1,i1-(i+1)),yf,t);
     while s[i1]<>' ' do
      inc(i1);
     while s[i1]=' ' do
      inc(i1);
      dec(i1);
     for i:=i1+1 to length(s) do
      if s[i]=' '  then break;
     dec(i);
      val(copy(s,i1+1,i-i1),pay,t);
     inc(p[num,yf],pay);
    end;
   if s[1]='I' then
    begin
     i2:=8;
     while s[i2]=' ' do
      inc(i2);
     for i:=i2 to length(s) do
      if s[i]=' ' then break;
      val(copy(s,i2,i-i2),num,t);
     for i1:=i+1 to length(s) do
      if s[i1]='/' then break;
      val(copy(s,i+1,i1-(i+1)),yf,t);
     while s[i1]<>' ' do
      inc(i1);
     while s[i1]=' ' do
      inc(i1);
     dec(i1);
     for i:=i1+1 to length(s) do
      if s[i]=' '  then break;
     dec(i);
      val(copy(s,i1+1,i-i1),pay,t);
     k:=pay;
     if k>=800 then
     begin
     if (k<=4000)and(k>=800) then k:=k-800
                             else k:=k*0.8;
      zs:=zs+0.2*(min(20000,k));
      zs:=zs+0.3*(min(30000,k-20000));
      zs:=zs+0.4*(min(k-50000,100000000000));
     end;
    end;
  end;
for i:=1 to m do
 for j:=1 to 12 do
   if p[i,j]<>0 then
    begin
     k:=p[i,j]-800;
     zs:=zs+0.05*min(k,500);
     zs:=zs+0.10*min((k-500),1500);
     zs:=zs+0.15*min((k-2000),3000);
     zs:=zs+0.20*min((k-5000),15000);
     zs:=zs+0.25*min((k-20000),20000);
     zs:=zs+0.30*min((k-40000),20000);
     zs:=zs+0.35*min((k-60000),20000);
     zs:=zs+0.40*min((k-80000),20000);
     zs:=zs+0.45*min((k-100000),10000000000000);
    end;
 write (zs:0:2);
close (input);
close (output);
end.