记录编号 79029 评测结果 AAAAA
题目名称 [NOI 1998]个人所得税 最终得分 100
用户昵称 Gravatar赵寒烨 是否通过 通过
代码语言 Pascal 运行时间 0.006 s
提交时间 2013-11-04 22:30:17 内存使用 4.74 MiB
显示代码纯文本
var
  a:array [1..50000,1..12] of double;
  c,s:string;
  i,j,n,k,m,code:longint;
  ans,x:double;
  blank:char;
function min(a,b:double):double;
  begin
    if a>b then exit(b) else exit(a);
  end;
procedure readstr(var s:string);
  var
    ch:char;
  begin
    s:='';
    read(ch);
    while (ch<>' ')and(not eof) do begin
      s:=s+ch;
      read(ch);
    end;
    if ch='#' then s:='#';
  end;
begin
  assign(input,'personaltax.in');reset(input);
  assign(output,'personaltax.out');rewrite(output);
  readln(n);
  readstr(c);
  while c[1]<>'#' do begin
    read(k);
    read(blank);
    while blank=' ' do read(blank);
    readstr(s);
    s:=blank+s;
    if s[2]='/' then m:=ord(s[1])-ord('0')
    else val(copy(s,1,2),m);
    readln(x);
    if c[1]='P' then a[k,m]:=a[k,m]+x
    else begin
      if x<800 then x:=0
      else if x<=4000 then x:=x-800
      else x:=x*0.8;
      ans:=ans+min(x,20000)*0.2;
      if x>20000 then
        ans:=ans+min(x-20000,30000)*0.3;
      if x>50000 then
        ans:=ans+(x-50000)*0.4;
    end;
    readstr(c);
  end;
  for i:=1 to n do
    for j:=1 to 12 do begin
      if a[i,j]<800 then a[i,j]:=0
      else a[i,j]:=a[i,j]-800;
      ans:=ans+min(a[i,j],500)*0.05;
      if a[i,j]>500 then
        ans:=ans+min(a[i,j]-500,1500)*0.1;
      if a[i,j]>2000 then
        ans:=ans+min(a[i,j]-2000,3000)*0.15;
      if a[i,j]>5000 then
        ans:=ans+min(a[i,j]-5000,15000)*0.2;
      if a[i,j]>20000 then
        ans:=ans+min(a[i,j]-20000,20000)*0.25;
      if a[i,j]>40000 then
        ans:=ans+min(a[i,j]-40000,20000)*0.3;
      if a[i,j]>60000 then
        ans:=ans+min(a[i,j]-60000,20000)*0.35;
      if a[i,j]>80000 then
        ans:=ans+min(a[i,j]-80000,20000)*0.4;
      if a[i,j]>100000 then
        ans:=ans+(a[i,j]-100000)*0.45;
    end;
  writeln(ans:0:2);
  close(input);
  close(output);
end.