记录编号 79281 评测结果 AWWWW
题目名称 [NOI 1998]个人所得税 最终得分 20
用户昵称 Gravatar毕之 是否通过 未通过
代码语言 Pascal 运行时间 0.003 s
提交时间 2013-11-05 12:46:39 内存使用 2.45 MiB
显示代码纯文本
const
  a:array[1..8]of integer=(25,150,450,3000,5000,6000,7000,8000);
  c:array[1..9]of longint=(500,2000,5000,20000,40000,60000,80000,100000,1);
  e:array[1..9]of real=(0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45);
  b:array[1..2]of integer=(4000,9000);d:array[1..3]of longint=(20000,50000,1);
  f:array[1..3]of real=(0.2,0.3,0.4);
var
  m,i,j,k,l,fei,n1,o,n,o1,z1,z2,y1,p:longint;
  x,s,s1:string;zong,fei1:real;y:array[1..4]of longint;
  g:array[1..50000,1..12]of longint;
begin
  assign(input,'personaltax.in');
  assign(output,'personaltax.out');
  reset(input);rewrite(output);
  readln(m);
  repeat
    readln(s);n1:=length(s);
    if s[n1]=' ' then
    while s[n1]=' ' do begin delete(s,n1,1);n1:=n1-1;end;
    if s[1]<>'#' then
    begin
      x:='';x:=x+s[1];x:=x+s[2];x:=x+s[3];
      if x='PAY' then
      begin
        o:=5;o1:=o;while s[o1+1]<>' ' do o1:=o1+1;
        s1:=copy(s,o,o1-o+1);val(s1,y[1],p);
        o:=o1+2;o1:=o;while s[o1+1]<>'/' do o1:=o1+1;
        s1:=copy(s,o,o1-o+1);val(s1,y[2],p);
        o:=o1+2;o1:=o;while s[o1+1]<>' ' do o1:=o1+1;
        s1:=copy(s,o,o1-o+1);val(s1,y[3],p);
        o:=o1+2;n:=length(s);
        s1:=copy(s,o,n-o+1);val(s1,y[4],p);
        g[y[1],y[2]]:=g[y[1],y[2]]+y[4];
      end else
      begin
        o:=length(s);
        while s[o-1]<>' ' do o:=o-1;
        s1:=copy(s,o,length(s)-o+1);val(s1,fei,p);
        if fei<=4000 then fei1:=fei-800 else fei1:=(fei*4)/5;j:=1;
        while (fei1>d[j]) and (j+1<=3) do j:=j+1;
        if j>=2 then
        begin
          for k:=1 to j-1 do zong:=zong+b[k];
          zong:=zong+(fei1-d[k])*f[k];
        end;
        if j=3 then zong:=zong+(fei1-50000)*2/5;
        if j=1 then zong:=zong+fei1/5;
      end;
    end;
  until s[1]='#';
  for i:=1 to m do
  for j:=1 to 12 do
  if g[i,j]>0 then
  begin
    g[i,j]:=g[i,j]-800;l:=1;
    while (g[i,j]>c[l]) and (l+1<=9) do
    l:=l+1;
    if l>=2 then
    begin
      for m:=1 to l-1 do zong:=zong+a[m];
      zong:=zong+(g[i,j]-c[m])*e[m+1];
    end;
    if j=10 then zong:=zong+(g[i,j]-100000)*45/100;
    if j=1 then zong:=zong+g[i,j]*0.05;
  end;
  writeln(zong:0:2);
  close(input);close(output);
end.