记录编号 31785 评测结果 WWWWW
题目名称 [NOI 1998]个人所得税 最终得分 0
用户昵称 Gravatarreamb 是否通过 未通过
代码语言 Pascal 运行时间 0.019 s
提交时间 2011-11-03 20:59:03 内存使用 4.70 MiB
显示代码纯文本
program gerensuodeshui;
var
  weizhi,m,i,j,h,y:longint;
  code:integer;
  s,s1:string;
  ans,money:real;
  g:array[1..50000,1..12]of real;
begin
  assign (input,'personaltax.in');
  reset (input);
  assign (output,'personaltax.out');
  rewrite (output);
    readln (m);
    readln (s);
    repeat
      weizhi:=pos(' ',s);
      s1:=copy(s,1,weizhi-1);
      if s1='PAY' then
      begin
        delete(s,1,weizhi);
        weizhi:=pos(' ',s);
        val(copy(s,1,weizhi-1),h,code);
        delete(s,1,weizhi);
        weizhi:=pos('/',s);
        val(copy(s,1,weizhi-1),y,code);
        weizhi:=pos(' ',s);
        delete(s,1,weizhi);
        val(s,money,code);
        g[h,y]:=g[h,y]+money
      end
      else
      begin
        delete(s,1,weizhi);
        weizhi:=pos(' ',s);
        delete(s,1,weizhi);
        weizhi:=pos(' ',s);
        delete(s,1,weizhi);
        val(s,money,code);
        if money<=4000 then
          money:=money-800
        else
          money:=money*0.8;
        if (money>0) then
        begin
          if money>20000 then
          begin
            ans:=ans+20000*0.2;
            if ans>50000 then
            begin
              ans:=ans+30000*0.3;
              ans:=ans+(ans-50000)*0.4
            end
            else
              ans:=ans+(money-20000)*0.3
          end
          else
            ans:=ans+money*0.2
        end;
      end;
      readln(s)
    until s='#';
    for i:=1 to m do
      for j:=1 to 12 do
      begin
        money:=g[i,j]-800;
        if money>0 then
        begin
          if money>500 then
          begin
            ans:=ans+500*0.05;
            if money>2000 then
            begin
              ans:=ans+1500*0.1;
              if money>5000 then
              begin
                ans:=ans+3000*0.15;
                if money>20000 then
                begin
                  ans:=ans+15000*0.2;
                  if money>40000 then
                  begin
                    ans:=ans+20000*0.25;
                    if money>60000 then
                    begin
                       ans:=ans+20000*0.3;
                       if money>80000 then
                       begin
                         ans:=ans+20000*0.35;
                         if money>100000 then
                         begin
                           ans:=ans+20000*0.4;
                           ans:=ans+(money-100000)*0.45
                         end
                         else
                           ans:=ans+(money-80000)*0.4
                       end
                       else
                         ans:=ans+(money-60000)*0.35
                    end
                    else
                      ans:=ans+(money-40000)*0.3
                  end
                  else
                    ans:=ans+(money-20000)*0.25
                end
                else
                  ans:=ans+(money-5000)*0.2
              end
              else
                ans:=ans+(money-2000)*0.15
            end
            else
              ans:=ans+(money-500)*0.1
          end
          else
            ans:=ans+money*0.05
        end;
      end;
    writeln (ans:0:2);
  close (input);
  close (output)
end.